What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-27 19:45:11
ReferenceError: require is not defined site:stackoverflow.com
const cors = require('cors'); const express = require('express'); const bodyParser = require('body-parser'); var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, { 'Content-Type': 'text/plain' }); ... Add solution -
Javascript 2022-03-05 14:35:24
app.post('/', function (req, res) { res.send('POST request to homepage') })
var express = require("express"); var bodyParser = require("body-parser"); var app = express(); app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.get('/... Add solution -
Javascript 2022-02-02 20:11:54
body parser deprecated
The package bodyParser is deprecated. You will get this warning with these lines of code: app.use(bodyparser.json()); app.use(bodyParser.urlencoded({extended: true})); If you are using Express 4.16+ you can now replace those lines with: app.use(expres... Add solution -
Javascript 2021-11-18 05:52:15
how to parse using express without body parser
//make sure it is in this order npm i body-parser const express = require('express') const bodyParser = require('body-parser') const app = express() // parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })) // pars... Add solution -
Javascript 2021-11-17 19:14:11
how to connect to mongoose and create a model
const express = require('express'); const app = express(); const mongoose = require('mongoose'); const bodyParser = require('body-parser'); app.use(bodyParser.json()); const PORT = process.env.PORT || 3000; //connecting to db try { mongoose.conne... Add solution -
Other 2021-11-14 13:07:14
apollo server-express
npm install apollo-server-express # yarn yarn add apollo-server-express # server.js import express from 'express'; import bodyParser from 'body-parser'; import { graphqlExpress } from 'apollo-server-express'; const myGraphQLSchema = // ... define or i... Add solution -
Javascript 2021-11-10 19:16:11
body-parser node
//make sure it is in this order npm i body-parser const express = require('express') const bodyParser = require('body-parser') const app = express() // parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })) // pars... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5