diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2021-04-04 00:45:50 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2021-04-04 00:45:50 +0200 |
| commit | 07d8db2bb758686466d4643f575b4b5280cc4791 (patch) | |
| tree | 32dcdc9595a7679cf4b0a05490a9298addf3b9fd /bin | |
Add project
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/corona-regeln | 28 |
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); + }) |