Quantcast
Channel: Express API JSON and XML POST request - Stack Overflow
Browsing latest articles
Browse All 6 View Live

Answer by Sachin Adkar for Express API JSON and XML POST request

router.use(bodyparser.raw({ type: 'application/xml' })); XML body will be parsed and it'll be in Buffer format. In the route you can do something like this new Buffer(req.body.data).toString() to get...

View Article



Answer by Voora Tarun for Express API JSON and XML POST request

The body is a readable stream and can be composed of chunks.You can do something like this in the handler.let body = "";let response = {}; if (req.method === "POST") { req.on("data", chunk => { body...

View Article

Answer by lazzy_ms for Express API JSON and XML POST request

I know it's lot late but, If you want to use both xml and json, you can use it with specific xml request like this,app.post('/receive-xml', xmlparser({trim: false, explicitArray: false}), function(req,...

View Article

Answer by vijayakumarpsg587 for Express API JSON and XML POST request

I believe you would be able to use it different routesappRoute1.jsconst express = require('express');const router = express.Router();const bodyParse = require('body-parser');const cookieParser =...

View Article

Answer by R. Gulbrandsen for Express API JSON and XML POST request

bodyParser only supports the following formats (if it is body-parser you're using):JSON body parserRaw body parserText body parserURL-encoded form body parserSo if you want to parse XML I suggest you...

View Article


Express API JSON and XML POST request

I have a express API which allows json post requests. However, in my scenario, one of my API's needs to accept a XML post body, rather than a JSON one. So my express app is set fine using: // Init...

View Article
Browsing latest articles
Browse All 6 View Live


Latest Images