]> git.r.bdr.sh - rbdr/corona-regeln/blob - bin/corona-regeln
Add project
[rbdr/corona-regeln] / bin / corona-regeln
1 #!/usr/bin/env node
2
3 const Fastify = require('fastify')({ logger: true })
4 const PointOfView = require('point-of-view');
5 const Eta = require('eta');
6 const { join } = require('path');
7
8 const CoronaRegeln = require('../lib/corona-regeln.js');
9 const Config = require('../config');
10
11 Fastify.register(PointOfView, {
12 engine: {
13 eta: Eta
14 },
15 root: join(__dirname, '../templates'),
16 });
17
18 Fastify.get('/', async (request, reply) => {
19
20 return reply.view('/index.eta', { rules: await CoronaRegeln.run(Config) });
21 });
22
23 Fastify.listen(Config.port)
24 .catch((error) => {
25
26 console.error(error.stack || error.message || error);
27 process.exit(1);
28 })