-
Notifications
You must be signed in to change notification settings - Fork 49
/
app.js
206 lines (172 loc) · 3.62 KB
/
app.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
import * as redirects from './redirects.js';
import * as routing from "./routing/index.js";
import { setupApp } from "./routing/setup.js";
import { RESOURCE_INDEX } from './config.js';
import { updateResourceVersions } from './resourceIndex.js';
const {
auspice,
canary,
charon,
cli,
community,
core,
errors,
fetch,
groups,
openid,
schemas,
staging,
staticSite,
listResources,
} = routing;
/* Express app setup.
*
* Includes authn routes:
* /login
* /logged-in
* /logout
*/
const app = setupApp();
/* Canary.
*/
canary.setup(app);
/* Redirects.
*/
redirects.setup(app);
/* Charon API used by Auspice.
*
* Routes:
* /charon/getAvailable
* /charon/getDataset
* /charon/getNarrative
* /charon/getSourceInfo
* /charon/*
*/
charon.setup(app);
/* Core datasets and narratives
*
* Routes:
* /dengue
* /ebola
* /enterovirus
* /flu
* /lassa
* /measles
* /mers
* /mumps
* /monkeypox
* /mpox
* /ncov
* /nextclade
* /rsv
* /tb
* /WNV
* /yellow-fever
* /zika
* /narratives/*
*/
core.setup(app);
/* Staging datasets and narratives
*
* Routes:
* /staging
* /staging/narratives
* /staging/narratives/*
* /staging/*
*/
staging.setup(app);
/* Community on GitHub
*
* Routes:
* /community/narratives/:user/:repo
* /community/narratives/:user/:repo/*
* /community/:user/:repo
* /community/:user/:repo/*
*/
community.setup(app);
/* Datasets and narratives at ~arbitrary remote URLs.
*
* Routes:
* /fetch/narratives/:authority/*
* /fetch/:authority/*
*/
fetch.setup(app);
/* Groups
*
* Routes:
* /groups/:groupName
* /groups/:groupName/settings
* /groups/:groupName/settings/logo
* /groups/:groupName/settings/overview
* /groups/:groupName/settings/members
* /groups/:groupName/settings/roles
* /groups/:groupName/settings/roles/:roleName/members
* /groups/:groupName/settings/roles/:roleName/members/:username
* /groups/:groupName/settings/*
* /groups/:groupName/narratives
* /groups/:groupName/narratives/*
* /groups/:groupName/*
* /whoami
* /users
* /users/:name
*/
groups.setup(app);
/* CLI convenience endpoints, e.g. downloads of release assets.
*
* Routes:
* /cli/download/:version/:assetSuffix")
* /cli/download/pr-build/:prId/:assetSuffix")
* /cli/download/ci-build/:runId/:assetSuffix")
* /cli/installer/:os")
* /cli")
*/
cli.setup(app);
/* JSON Schemas.
*
* Routes:
* /schemas/augur/annotations
* /schemas/augur/frequencies
* /schemas/auspice/config/v2
* /schemas/dataset/v1/meta
* /schemas/dataset/v1/tree
* /schemas/dataset/v2
* /schemas/dataset/root-sequence
* /schemas/dataset/tip-frequencies
* /schemas/dataset/measurements
*/
schemas.setup(app);
/* OpenID Connect 1.0 configuration.
*
* Routes:
* /.well-known/openid-configuration
*/
openid.setup(app);
/* Auspice.
*
* Routes:
* /dist/*
* /edit/narratives
*/
auspice.setup(app);
/* Set up the API to serve resource-listing requests
* If RESOURCE_INDEX is false, all API requests are currently non-200.
* Note: must come before staticSite.setup as that handler (next.js) will
* catch all routes
*/
listResources.setup(app);
/* static-site (Next.js).
*/
await staticSite.setup(app);
/* Error handling.
*/
errors.setup(app);
/**
* Update the resources we know about. If the index is located on S3 then we
* check the eTag to know whether to update, and thus most calls to
* `updateResourceVersions` simply involve a HEAD request.
*/
if (RESOURCE_INDEX) {
updateResourceVersions();
setInterval(updateResourceVersions, 60*60*1000)
}
export default app;