2019-06-28 11:31:32 +02:00
|
|
|
export const config = {
|
|
|
|
api: {
|
2019-11-11 04:24:53 +01:00
|
|
|
bodyParser: false,
|
|
|
|
},
|
2019-06-28 11:31:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default (req, res) => {
|
2020-05-18 21:24:37 +02:00
|
|
|
return new Promise((resolve) => {
|
2020-01-10 16:56:20 +01:00
|
|
|
if (!req.body) {
|
|
|
|
let buffer = ''
|
2020-05-18 21:24:37 +02:00
|
|
|
req.on('data', (chunk) => {
|
2020-01-10 16:56:20 +01:00
|
|
|
buffer += chunk
|
|
|
|
})
|
2019-06-28 11:31:32 +02:00
|
|
|
|
2020-01-10 16:56:20 +01:00
|
|
|
req.on('end', () => {
|
|
|
|
res.status(200).json(JSON.parse(Buffer.from(buffer).toString()))
|
|
|
|
resolve()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2019-06-28 11:31:32 +02:00
|
|
|
}
|