Home > database >  How to fix mongos post request from postman
How to fix mongos post request from postman

Time:12-26

I am new ,i am having problem posting some data on mongodb model(users) from postmanenter image description here

Expecting a successful post request

CodePudding user response:

For the latest version of Express which is (Express v4.16.0 and higher) Use this in your server.js file: ----->

const express = require('express');

app.use(express.json());
app.use(express.urlencoded({
  extended: true
}));
// For Express version less than 4.16.0 // ------------------------------------

const bodyParser = require('body-parser');

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
  extended: true
}));
  • Related