Answers for "const mainRouter = express.Router(); mainRouter.use(bodyParser.json());"

1

express.bodyparser express 4

// Express v4.16.0 and higher
// --------------------------
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
}));
Posted by: Guest on June-30-2021

Code answers related to "const mainRouter = express.Router(); mainRouter.use(bodyParser.json());"

Code answers related to "Javascript"

Browse Popular Code Answers by Language