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(' +-----+');