I want to read the sent request and save in the following json object. console.log
does not even log the data to console. I also tried JSON.Parse()
but it didn't work.
var express = require('express');
var bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.post('/addteacher', function(request, response) {
console.log(request.body);
});
// var inMemory = { teacher: { 1: { id: 1, name: 'name example 1', age: 23, job: 'example job', co-workers: [] }, } };
via Raj
No comments:
Post a Comment