Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jameskyburz/server-base
base for micro services or simple servers
https://github.com/jameskyburz/server-base
fasthttp fasthttprouter http http-framework microservices nodejs server server-base server-base-logger
Last synced: about 2 months ago
JSON representation
base for micro services or simple servers
- Host: GitHub
- URL: https://github.com/jameskyburz/server-base
- Owner: JamesKyburz
- License: other
- Created: 2015-11-27T20:18:33.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2023-02-27T07:59:53.000Z (almost 2 years ago)
- Last Synced: 2024-10-20T01:07:11.642Z (2 months ago)
- Topics: fasthttp, fasthttprouter, http, http-framework, microservices, nodejs, server, server-base, server-base-logger
- Language: JavaScript
- Homepage: http://npm.im/server-base
- Size: 1.32 MB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: readme.markdown
- License: LICENSE
Awesome Lists containing this project
README
# server base
base for micro services or simple servers
[![js-standard-style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/feross/standard)
[![build status](https://github.com/JamesKyburz/server-base/actions/workflows/main.yml/badge.svg)](https://github.com/JamesKyburz/server-base/actions/workflows/main.yml)
[![downloads](https://img.shields.io/npm/dm/server-base.svg)](https://npmjs.org/package/server-base)### usage
```javascript
const service = require('server-base')
service({
'@setup': (ctx, router) => {
ctx.use([
(req, res, next) => next()
])
ctx.onError([
(req, res, error, next) => next()
])
},
'/graphql': {
get (req, res) {
res.end('html')
},
async post (req, res) {
const query = await req.json()
res.json({})
}
}
})
.start(5000)
```### router
See [server-base-router](https://github.com/JamesKyburz/server-base/tree/master/packages/server-base-router) for details.
See [server-base-router-tests](https://github.com/JamesKyburz/server-base/tree/master/packages/server-base-router/test) for details.
### logger
See [server-base-log](https://github.com/JamesKyburz/server-base/tree/master/packages/server-base-log) for details.
### .env
If a .env file exists it will load the values into process.env using [dotenv](https://npm.im/dotenv).
```dosini
PORT=1900
```# install
With [npm](https://npmjs.org) do:
```
npm install server-base
```# license
[Apache License, Version 2.0](LICENSE)