Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

113
Views
How to read json object sent over post request and save/append to in memory json object- Node js?

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 tried JSON.Parse(), didn't work.

var express = require('express'); 
bodyParser = require('body-parser'); 
pp.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: [] }, } };
8 months ago ยท Santiago Trujillo
Answer question
Find remote jobs