1 | <p align='center'>
|
2 | <img src='https://cloud.githubusercontent.com/assets/425716/12668376/cc4011ca-c60a-11e5-89f6-0759db74079b.png' width='400'/>
|
3 | <p align='center'>Build next-generation realtime APIs simply and easily</p>
|
4 | </p>
|
5 |
|
6 | ## Install
|
7 |
|
8 | One command and you're ready to make some killer APIs:
|
9 | ```
|
10 | npm install sutro --save
|
11 | ```
|
12 |
|
13 | **Now**, check out the [documentation](https://github.com/shastajs/sutro/tree/master/docs) to get started!
|
14 |
|
15 |
|
16 | ## Examples
|
17 |
|
18 | ### 10-LOC ES7 API
|
19 |
|
20 | ```js
|
21 | const api = {
|
22 | user: {
|
23 | create: async ({ data }) => User.create(data),
|
24 | find: async ({ options }) => User.findAll(options),
|
25 | findById: async ({ userId }) => User.findById(userId),
|
26 | updateById: async ({ userId, data }) => User.updateById(userId, data),
|
27 | replaceById: async ({ userId, data }) => User.replaceById(userId, data),
|
28 | deleteById: async ({ userId }) => User.deleteById(userId)
|
29 | }
|
30 | }
|
31 | ```
|
32 |
|
33 | Yields:
|
34 |
|
35 | ```
|
36 | GET /swagger.json
|
37 | GET /users
|
38 | POST /users
|
39 | GET /users/:userId
|
40 | PATCH /users/:userId
|
41 | PUT /users/:userId
|
42 | DELETE /users/:userId
|
43 | ```
|