A simple body parser middleware for node-server or ExpressJS.
Zero dependency less than 40 lines compatible to ExpressJS
$ git clone git@github.com:amazingandyyy/body-parser.git
const express = require('express')
const bodyParser = require('@amazingandyyy/body-parser')
const app = express()
app.use(bodyParser)
app.post('/content', function (req, res) {
console.log(req.body)
res.send(req.body)
})
app.listen(3000)
const NodeServer = require('@amazingandyyy/node-server')
const nodeServerParser = require('@amazingandyyy/body-parser');
const app = new NodeServer()
app.use(nodeServerParser)
app.on('post', '/content', (req, res)=>{
console.log(req.body)
res.send(req.body)
})
app.start({ port: 4000 })
MIT