Como acessar campos de pós -formulário em Express
app.use(express.json());
app.use(express.urlencoded());
app.use(express.multipart());
SAMER SAEID
app.use(express.json());
app.use(express.urlencoded());
app.use(express.multipart());
$ npm install --save body-parser
app.use(express.json()); // to support JSON-encoded bodies
app.use(express.urlencoded()); // to support URL-encoded bodies
app.use(express.json());
app.use(express.urlencoded());
app.use(express.multipart());
var bodyParser = require('body-parser')
app.use( bodyParser.json() ); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));
// assuming POST: name=foo&color=red <-- URL encoding
//
// or POST: {"name":"foo","color":"red"} <-- JSON encoding
app.post('/test-page', function(req, res) {
var name = req.body.name,
color = req.body.color;
// ...
});