Skip to content

Commit

Permalink
feat: increase default max body size to 1mb
Browse files Browse the repository at this point in the history
  • Loading branch information
error418 committed Sep 1, 2020
1 parent a8a2d85 commit ca2585f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/webserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@ export class WebServer {
private initialize() {
log.info("initializing server...");

const maxBodySize = process.env["MAX_BODY_SIZE"] || "1mb";
log.info("setting max body-size to %s", maxBodySize);

// express configuration
this.app.set("port", this.port);
this.app.use(compression());
this.app.use(bodyParser.json());
this.app.use(bodyParser.urlencoded({ extended: true }));
this.app.use(bodyParser.json({
limit: maxBodySize
}));
this.app.use(bodyParser.urlencoded({
limit: maxBodySize,
extended: true
}));


// set common headers
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down

0 comments on commit ca2585f

Please sign in to comment.