forked from SteinHQ/Stein
-
Notifications
You must be signed in to change notification settings - Fork 1
/
apiRoutes.js
40 lines (35 loc) · 877 Bytes
/
apiRoutes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const controllers = require("./controllers");
module.exports = app => {
/*
-----
Storage Public API Routes
-----
*/
/*
Route for giving JSON results for read & search
URL structure: /?search={"key":"value", ...}
*/
app.get("/v1/storages/:id/:sheet", controllers.storage.readSheet);
/*
Append a new row
POST body: [{row object}, ...]
*/
app.post("/v1/storages/:id/:sheet", controllers.storage.appendRow);
/*
Edit row(s)
POST body -> {
condition: {column:value, ...},
set: {column: value, ...},
limit: INTEGER (optional)
}
*/
app.put("/v1/storages/:id/:sheet", controllers.storage.editRow);
/*
Delete row(s)
DELETE body -> {
condition: {column: value, ...},
limit: INTEGER (optional)
}
*/
app.delete("/v1/storages/:id/:sheet", controllers.storage.deleteRow);
};