set specific bodyParser for just one route express


I set app.use(bodyParser.json()); in my app.js (main file).
I need to change with bodyParser.text() in another file (foo.js) just for one route. External service send me a request POST 'Content-Type: text/plain; charset=utf-8' and I need to retrieve the content


See the following API Doc at

You can add middleware(s) to a specific route:

app.get('/', bodyParser.text(), function (req, res) {

Answered By – Daniel

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published