Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amazingandyyy/body-parser

👷 A simple body parser middleware for node-server or ExpressJS.
https://github.com/amazingandyyy/body-parser

body-parser expressjs http https node-server nodejs openjs opensource scratchese server util

Last synced: 11 days ago
JSON representation

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

Awesome Lists containing this project

README

        


👷 body-parser



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











> Zero dependency
> less than 40 lines
> compatible to ExpressJS

## Installation

```shell
$ git clone [email protected]:amazingandyyy/body-parser.git
```

## Usage

### ExpressJS

```javascript
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

```javascript
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