Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express bodyparser

const express = require('express')
const bodyParser = require('body-parser')

const app = express()

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))

// parse application/json
app.use(bodyParser.json())

app.use(function (req, res) {
  res.setHeader('Content-Type', 'text/plain')
  res.write('you posted:
')
  res.end(JSON.stringify(req.body, null, 2))
})

 
PREVIOUS NEXT
Tagged: #express #bodyparser
ADD COMMENT
Topic
Name
5+6 =