app.use(express.json());
// ...
app.post('/test-page', function(req, res) {
var name = req.body.name,
color = req.body.color;
// ...
});
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());
// in latest body-parser use like below.
app.use(bodyParser.urlencoded({ extended: true }));