forked from ltonetwork/mongodb-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
98 lines (98 loc) · 2.11 KB
/
config.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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
module.exports = {
db: process.env.MONGODB || process.env.MONGOLAB_URI || 'mongodb://localhost:27017',
server: {
port: process.env.PORT || 3000,
address: '0.0.0.0'
},
accessControl: {
allowOrigin: '*',
allowMethods: 'GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS',
allowCredentials: true
},
mongoOptions: {
serverOptions: {},
dbOptions: {
w: 1
}
},
logger: {
verbose (msg) {
console.log(msg)
},
info (msg) {
console.log(msg)
},
warning (msg) {
console.warn(msg)
},
error (msg) {
// console.log(msg)
throw Error(msg)
}
},
humanReadableOutput: true,
collectionOutputType: 'json',
urlPrefix: '',
queryKeys: {
// Same as https://github.com/typicode/json-server
page: '_page',
sort: '_sort',
order: '_order', // 'desc' : 'asc'
// Slice
start: '_start',
end: '_end',
limit: '_limit',
// Opterators
_gte: '_gte',
_lte: '_lte',
_ne: '_ne',
_like: '_like', // E.g. title_like=server
// Full text search
query: 'q',
// Relationshipts
embed: '_embed',
expand: '_expand'
},
schema: {
test: {
users: {
definitions: {},
$schema: 'http://json-schema.org/draft-07/schema#',
$id: 'http://example.com/root.json',
type: 'object',
title: 'The Root Schema',
required: [
'price',
'tags'
],
properties: {
price: {
$id: '#/properties/price',
type: 'number',
title: 'The Price Schema',
default: 0.0,
examples: [
12.5
]
},
tags: {
$id: '#/properties/tags',
type: 'array',
title: 'The Tags Schema',
items: {
$id: '#/properties/tags/items',
type: 'string',
title: 'The Items Schema',
default: '',
examples: [
'home',
'green'
],
pattern: '^(.*)$'
}
}
}
}
}
}
}