0

I tried to receive the input value from the user through form request using express handlebars. I get the following error.

TypeError: Cannot read property 'personname' of undefined

The following pictures contain the code snippets

index.js home.handlebars

Please Help me to resolve the issue

Mowrish
  • 15
  • 5

1 Answers1

1

Express won't parse req.body for you by default. You need middleware, preferably body-parser

const app = require('express')()
const bodyparser = require('body-parser')

app.use(bodyparser.json());
app.use(bodyparser.urlencoded({extended: true}));
bcr
  • 3,791
  • 18
  • 28