mini-web-server
v1.0.2
Published
Web server that supports a single POST route, and optionally a webhook
Downloads
7
Maintainers
Readme
Mini web server
A small, dependency free, single route web server
- Supports POST bodies
- JSON by default (we'll encode responses for you)
- ES8
- No callbacks - routes return an object with 'status' and 'body'
Usage
const webserver = require('mini-web-server'),
STATUS_CODES = require('http-status-codes')
port = 6666,
host = 'localhost'
await webserver(port, host, async function route(request) {
log(`We have recieved a request!`)
return {
status: STATUS_CODES.OK,
body: {
'success': 'woo!'
}
}
})
log(`Started test web server to get response`)