One way I applied a byte limit in Expressjs was to use piping the data stream from a request:
const byteLimit = (process.env.BYTELIMIT || 32*1024*1024); app.all(\