Answers for "how to use express parser 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
0

how to parse using express without body parser

const express = require('express')

const app = express()

app.use(express.json())
app.use(express.urlencoded())
Posted by: Guest on July-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language