Limit the payload size and the timeout of a route
At the end of a route you can add limits that start with <. <2mb, <10kb and <500b set the maximum size of the request body; <30s, <5m and <1h set the timeout of the request. A request over the limit is rejected before your handler runs.
exports.install = function() {
ROUTE('POST /small/ <1kb', small);
ROUTE('POST /big/ <5mb', big);
};
function small($) {
$.json({ ok: true });
}
function big($) {
$.json({ ok: true });
}