-
Notifications
You must be signed in to change notification settings - Fork 3
/
router.js
41 lines (31 loc) · 891 Bytes
/
router.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
import express from 'express';
import logger from '../logger.js';
// Import manifests
import preview from '../views/preview.view.js';
import manifest from '../manifests/manifests.js';
// Import Views
// Initiate Router
const router = express.Router();
// Set up routes
router.get(
'/manifest',
(req, res) => {
logger.info('Request /manifest route');
return res.json(manifest);
}
);
router.get('/component', (req, res) => {
logger.info('Request /component route');
res.type('text/html');
res.end('<amedia-frontpage> Her skal forsiden komme </amedia-frontpage>');
});
router.get('/preview', (req, res) => {
logger.info('Request /preview route');
res.type('text/html');
// Kan vi ha publication som en query param til routen?
const html = preview({ publication: 'www.dt.no' });
res.end(html);
});
// Legg inn
// Export application
export default router;