Answers for "do we need body parser for GET request in express"

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
2

body parser express

app.use(express.json()); //Used to parse JSON bodies
Posted by: Guest on December-24-2020

Code answers related to "do we need body parser for GET request in express"

Code answers related to "Javascript"

Browse Popular Code Answers by Language