Skip to content

👷 A simple body parser middleware for node-server or ExpressJS.

License

Notifications You must be signed in to change notification settings

amazingandyyy/body-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👷 body-parser

A simple body parser middleware for node-server or ExpressJS.

Zero dependency less than 40 lines compatible to ExpressJS

Installation

$ git clone git@github.com:amazingandyyy/body-parser.git

Usage

ExpressJS

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)

Node-Server

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 })

License

MIT

Releases

No releases published

Packages

No packages published