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

Answer by CHANDAN KUMAR for Express.js req.body undefined

$
0
0

Updated: October 2022

First check or add the body parser using below step:

step :1import bodyParser from 'body-parser';

step 2:app.use(bodyParser.urlencoded({ extended: false }));app.use(bodyParser.json());

step 3: most important router shoud be define below of body parser that is the main reason for body undefined....

import noteRouter from "./src/routes/category_routes.js";

app.use(noteRouter);

whatever you name define in router depends on you..

Hope this help you guyz


Viewing all articles
Browse latest Browse all 54

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>