diff options
Diffstat (limited to 'index.js')
| -rw-r--r-- | index.js | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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(' +-----+'); |