Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

70
Vistas
postman does not store value

So I am trying to enter a post using postman into a mongo db server but my post just returns empty. When I look into my server nothing has been entered and there is no error

Route file

router.post('/', async (req,res) => {
const post = new customer({
    fullName: req.body.fullName,
    id: req.body.id
});
try{
    const savedCust = await customer.save();
    res.json(savedCust);
} catch (err) {
    res.json({message: err});
}
});

module.exports = router;

This is what I submit on postman:

{
    "fullName" : "Tim Scott",
    "id": 87438
}

And this is the response that I get back:

{
    "message": {}
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The error said that customer.save() isn't a function. This happened in your try {...} block inside your route file. The reason for that is that it's not a function. You should be doing post.save():

// route file
const express = require('express');
const router = express.Router();
const customer = require('../models/customer');
router.post('/', async (req,res) => {
  const post = new customer({
    fullName: req.body.fullName,
    id: req.body.id
  });
  try {
    const savedCust = await post.save(); // right here
    res.json(savedCust);
  } catch (err) {
    res.json({message: err});
  }
});

module.exports = router;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda