2017-04-11 21:31:22 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const bodyParser = require('body-parser')
|
|
|
|
|
2020-01-04 21:59:57 +00:00
|
|
|
exports.wrap = innerHandler => (req, res, next) => innerHandler(req, res).catch(err => next(err))
|
|
|
|
|
2017-04-11 21:31:22 +00:00
|
|
|
// create application/x-www-form-urlencoded parser
|
|
|
|
exports.urlencodedParser = bodyParser.urlencoded({
|
|
|
|
extended: false,
|
|
|
|
limit: 1024 * 1024 * 10 // 10 mb
|
|
|
|
})
|
2018-01-10 23:51:22 +00:00
|
|
|
|
|
|
|
// create text/markdown parser
|
|
|
|
exports.markdownParser = bodyParser.text({
|
|
|
|
inflate: true,
|
|
|
|
type: ['text/plain', 'text/markdown'],
|
|
|
|
limit: 1024 * 1024 * 10 // 10 mb
|
|
|
|
})
|