1 | module.exports = ({
|
2 | ClientConfig,
|
3 | router,
|
4 | cacheMiddleware,
|
5 | asyncMiddleware,
|
6 | getConfig,
|
7 | handleResponse,
|
8 | handleError,
|
9 | }) => {
|
10 |
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | router.get(
|
31 | '/metadata.:ext?',
|
32 | cacheMiddleware,
|
33 | asyncMiddleware(async (req, res) => {
|
34 | const cc = ClientConfig(await getConfig(req.session.slug));
|
35 |
|
36 | const clientConfig = await cc.get();
|
37 |
|
38 | try {
|
39 | handleResponse(req, res, clientConfig.client.metadata, true);
|
40 | } catch (error) {
|
41 | handleError(req, res, error);
|
42 | }
|
43 | })
|
44 | );
|
45 |
|
46 | };
|