-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuch.config.js
More file actions
85 lines (85 loc) · 1.98 KB
/
such.config.js
File metadata and controls
85 lines (85 loc) · 1.98 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const { port, prefix } = require("./config");
module.exports = {
extends: ["such:recommend"],
config: {
suchDir: "suchas",
dataDir: "suchas/data",
preload: true,
server: {
port: port,
watch: true,
cors: true,
prefix: [
prefix,
{
exclude: [
{
path: "/list/:id?",
method: "post",
},
],
},
],
route: {
"list/:id?": {
method: "post",
},
},
directory: "server",
pathSegSplit: ".",
injectContext: true,
timeout: [500, 1000],
buildConfig: function (pathname, ctx) {
if (pathname === "list/1" && ctx.method === "get") {
return {
timeout: [100, 300],
headers: {
From: "www.suchjs.com",
},
instance: {
config: {
dynamics: {
"/errmsg": [
"/errno",
(errno) => {
return {
key: {
exist: errno.value !== 0,
},
};
},
],
"/data": [
"/errno",
(errno) => {
return {
key: {
exist: errno.value === 0,
},
};
},
],
},
},
},
options: {
// keys: {
// "/errno": {
// index: 0,
// },
// "/data": {
// exist: true,
// },
// },
},
};
}
},
},
},
types: {
we: ["dict", "&<dataDir>/dict.txt"],
province: ["cascader", "&<dataDir>/city.json:#[root=true]"],
},
alias: {},
};