how does node js and an html form send and recieve data

  Kiến thức lập trình

I need help to understand where the data is stored and sent from node js and how an html form sends data

`const express = require(‘express’);
const cors = require(‘cors’);
const app = express();

app.use(cors()); // Allows request from any IP (prevent any CORS error)

// Enable parsing of URL-encoded data on all routes:
app.use(express.urlencoded({
extended: false, // Whether to use algorithm that can handle non-flat data strutures
limit: 10000, // Limit payload size in bytes
parameterLimit: 2, // Limit number of form items on payload
}));

app.post(‘what do i put in here’, function(req, res) {

console.log(req.body);
// { firstName: ‘Barry’, lastName: ‘Manilow’ }

});

app.listen(3000);
`
// where is the data from the html form so i can check it i get cannot post

New contributor

joshua is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT