#express js#node#node js#post#forms

How to get form data in post request in Express JS - Node JS

Saturday, Oct 22, 2022

if you are starting new with Node JS, you will probably face this problem, while submitting the form to a post URL.

The problem you will face is getting a empty req.body in-spite of sending the form properly. To resolve this issue, you have make two change in your current system.

Add the following to the form element


Though, if you do not add this it will still work as this is the default for a form.

The second thing, in your index.js in root add the following lines to unable the form.

    extended: true

This is it, now you will be able to receive the form data in req.body

if you are facing the same issue for the JSON inputs in your API calls, please check the link here to unable it.