Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pablocattaneo/39f04b23b4044f9b1f06c3e0c0a27132 to your computer and use it in GitHub Desktop.
Save pablocattaneo/39f04b23b4044f9b1f06c3e0c0a27132 to your computer and use it in GitHub Desktop.
// npm install --save body-parser
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
//This example shows a middleware function with no mount path. The function is executed every time the app receives a request.
app.use(bodyParser.urlencoded({extended:false})) // Parse x-form-www-urlencoded
app.use('/insert', (req, res) => {
console.log(req.body)
res.send('insert!')
})
// npm install --save body-parser
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
//This example shows a middleware function with no mount path. The function is executed every time the app receives a request.
app.use(bodyParser.json()) // Parse json format
app.use('/insert', (req, res) => {
console.log(req.body)
res.send('insert!')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment