aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2021-04-04 00:45:50 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2021-04-04 00:45:50 +0200
commit07d8db2bb758686466d4643f575b4b5280cc4791 (patch)
tree32dcdc9595a7679cf4b0a05490a9298addf3b9fd /bin
Add project
Diffstat (limited to 'bin')
-rwxr-xr-xbin/corona-regeln28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/corona-regeln b/bin/corona-regeln
new file mode 100755
index 0000000..2a0fbfb
--- /dev/null
+++ b/bin/corona-regeln
@@ -0,0 +1,28 @@
+#!/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);
+ })