UNPKG

2.13 kBJSONView Raw
1[
2 {
3 "id": "$global",
4 "name": "全局数据",
5 "url": "全局数据",
6 "method": "GET",
7 "global": true,
8 "content": {
9 "message": "Hello Faked!",
10 "list": [
11 {
12 "name": "faked"
13 }
14 ]
15 },
16 "checked": true
17 },
18 {
19 "id": "c2ee82bdc7764b5e16f74bbb487c1e6e",
20 "name": "示例:静态数据",
21 "method": "GET",
22 "url": "/api/echo",
23 "content": {
24 "message": "Hello Faked!"
25 },
26 "checked": true
27 },
28 {
29 "id": "32baa1cbea4deee52ec97f73f13918fe",
30 "name": "示例:动态添加",
31 "method": "POST",
32 "url": "/api/items/{name}",
33 "content": "//!exec\n\n//通过 //!exec 声明为执行逻辑\n//通过 global 访问全局对象\n//通过 this.send 发送数据\n//通过 this.params 访问路由参数\n//通过 this.body 访问请求主体\n//通过 this.query 访问查询字符串\n\nlet item = this.body;\nitem.name = this.params.name;\nglobal.list.push(item);\nthis.send({ success: true }); ",
34 "checked": true
35 },
36 {
37 "id": "ed88f1011a47687be23bc4140b77a470",
38 "name": "示例:动态删除",
39 "method": "DELETE",
40 "url": "/api/items/{name}",
41 "content": "//!exec\n\n//通过 //!exec 声明为执行逻辑\n//通过 global 访问全局对象\n//通过 this.send 发送数据\n//通过 this.params 访问路由参数\n//通过 this.body 访问请求主体\n//通过 this.query 访问查询字符串\n\nlet index = global.list.findIndex(item => item.name == this.params.name);\nglobal.list.splice(index, 1);\nthis.send({ success: true }); ",
42 "checked": true
43 },
44 {
45 "id": "ea0a8bb3f5e93d4936ef0fa026ef91de",
46 "name": "示例:动态查询",
47 "method": "GET",
48 "url": "/api/items/{name}",
49 "content": "//!exec\n\n//通过 //!exec 声明为执行逻辑\n//通过 global 访问全局对象\n//通过 this.send 发送数据\n//通过 this.params 访问路由参数\n//通过 this.body 访问请求主体\n//通过 this.query 访问查询字符串\n\nlet item = global.list.find(item => item.name == this.params.name);\nthis.send({ success: true, item: item }); ",
50 "checked": true
51 }
52]
\No newline at end of file