1 | @537/service
|
2 | ===
|
3 |
|
4 | [![build status](https://travis-ci.org/53seven/service.svg)](https://travis-ci.org/53seven/service)
|
5 |
|
6 |
|
7 |
|
8 | A 'set and forget' opinionated implementation of express. Useful for stateless apis.
|
9 |
|
10 | ```
|
11 | const service = require('@537/service');
|
12 | const pck = require('./package.json');
|
13 | const index_routes = require('routes/index');
|
14 | const user_routes = require('routes/user');
|
15 |
|
16 | // sets up all the routes and middleware
|
17 | const 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
|
25 | const server = service.start(app);
|
26 |
|
27 | // alternatively:
|
28 |
|
29 | // set up routes and listen on the port right away
|
30 | const server = service.run(pck, {
|
31 | '/': index_routes,
|
32 | '/user': user_routes
|
33 | });
|
34 |
|
35 | ```
|
36 |
|
37 | License
|
38 | ===
|
39 |
|
40 | MIT
|