Quantcast
Channel: Express.js req.body undefined - Stack Overflow
Viewing all articles
Browse latest Browse all 54

Answer by Hicham Mounadi for Express.js req.body undefined

$
0
0

As I get the same problem, although I know BodyParser is no longer usedand I already used the app.use(express.json())the problem was {FOR ME}:I was placing

app.use(express.json())

after

app.use('api/v1/example', example) => { concerns the route }

once I reorder those two lines;

1 - app.use(express.json())

2 - app.use('api/v1/example', example)

It worked perfectly


Viewing all articles
Browse latest Browse all 54

Trending Articles