UNPKG

1.03 kBMarkdownView Raw
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
8One command and you're ready to make some killer APIs:
9
10```
11npm install sutro --save
12```
13
14**Now**, check out the [documentation](https://github.com/contra/sutro/tree/master/docs) to get started!
15
16## Examples
17
18### 10-LOC ES7 API
19
20```js
21const 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
33Yields:
34
35```
36GET /swagger.json
37GET /users
38POST /users
39GET /users/:userId
40PATCH /users/:userId
41PUT /users/:userId
42DELETE /users/:userId
43```