Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

115
Vistas
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: [] }, } };
9 months ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos