Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/amazingandyyy/node-server

📡 A simple node server module, in less than 120 lines, compatible to expressjs middlewares
https://github.com/amazingandyyy/node-server

express http http2 https koa nodejs opensource restful-api scratchese server

Last synced: 11 days ago
JSON representation

📡 A simple node server module, in less than 120 lines, compatible to expressjs middlewares

Awesome Lists containing this project

README

        


📡 node-server



A simple node server module.











> compatible to express middleware!

> zero dependencies

## Installation
```shell
$ npm i --save @amazingandyyy/node-server
# or
$ yarn add @amazingandyyy/node-server
```

## Usage

```javascript
const NodeServer = require('@amazingandyyy/node-server')
const bodyParser = require('@amazingandyyy/body-parser');
const morgan = require('morgan') // compatible to express middlewares

const app = new NodeServer()

app.use(morgan('dev'))
app.use(bodyParser)

app.get('/ping', (req, res)=>{
res.send('pong')
})

app.post('/register', (req, res)=>{
res.send(req.body)
})

app.start({ port: 4000 })

```

## License

MIT