X-Git-Url: https://git.r.bdr.sh/rbdr/lgtm/blobdiff_plain/927c9aae8b0e28b39f0ee913d9bf53a3c0687e43..a2a2b553f69a66f1825347abde4f0028773bdbdb:/index.js?ds=inline diff --git a/index.js b/index.js index 46d4049..cc5c3b9 100644 --- a/index.js +++ b/index.js @@ -3,15 +3,28 @@ const Config = require('./config/config'); const Koa = require('koa'); const KoaStatic = require('koa-static'); +const Nunjucks = require('nunjucks'); +const RecordFetcher = require('./lib/record_fetcher'); const internals = {}; internals.run = () => { + Nunjucks.configure(Config.templateDirectory); + internals.app = Koa(); internals.app.use(KoaStatic(Config.staticDirectory)); + const recordFetcher = new RecordFetcher(); + internals.app.use(function * () { + + const record = yield recordFetcher.fetch(); + const parsedTemplate = Nunjucks.render('index.html.njk', record); + + this.body = parsedTemplate; + }); + console.log(' .'); console.log(' /'); console.log(' +-----+');