UNPKG

809 BMarkdownView Raw
1@537/service
2===
3
4[![build status](https://travis-ci.org/53seven/service.svg)](https://travis-ci.org/53seven/service)
5
6
7
8A 'set and forget' opinionated implementation of express. Useful for stateless apis.
9
10```
11const service = require('@537/service');
12const pck = require('./package.json');
13const index_routes = require('routes/index');
14const user_routes = require('routes/user');
15
16// sets up all the routes and middleware
17const app = service.bootstrap(pck, {
18 '/': index_routes,
19 '/user': user_routes
20});
21
22// do any extra config here....
23
24// binds the express app to a port and starts listening
25const server = service.start(app);
26
27// alternatively:
28
29// set up routes and listen on the port right away
30const server = service.run(pck, {
31 '/': index_routes,
32 '/user': user_routes
33});
34
35```
36
37License
38===
39
40MIT