#!/usr/bin/env node const Fastify = require('fastify')({ logger: true }) const PointOfView = require('point-of-view'); const Eta = require('eta'); const { join } = require('path'); const CoronaRegeln = require('../lib/corona-regeln.js'); const Config = require('../config'); Fastify.register(PointOfView, { engine: { eta: Eta }, root: join(__dirname, '../templates'), }); Fastify.get('/', async (request, reply) => { return reply.view('/index.eta', { rules: await CoronaRegeln.run(Config) }); }); Fastify.listen(Config.port) .catch((error) => { console.error(error.stack || error.message || error); process.exit(1); })