Parse body

This commit is contained in:
Kristian Polso 2018-06-08 13:23:04 +03:00
parent 25f25be78e
commit cd6aa2ee29

View file

@ -43,7 +43,9 @@ app.use(serveStatic(__dirname + "/content/.vuepress/dist"));
app.use(cors()); app.use(cors());
app.use(bodyParser.text()); var textParser = bodyParser.text({
limit: '256kb'
});
app.get('/forward', function(req, res) { app.get('/forward', function(req, res) {
@ -105,7 +107,7 @@ app.get('/github-feed', function(req, res) {
}); });
app.post('/upload-image', function(req, res) { app.post('/upload-image', textParser, function(req, res) {
request({ request({
method: "PUT", method: "PUT",
@ -115,6 +117,7 @@ app.post('/upload-image', function(req, res) {
}, },
body: req.body, body: req.body,
}, function(error, response, body) { }, function(error, response, body) {
body = JSON.parse(body);
res.json(body); res.json(body);
}); });