all repos — archive/homestead @ 553a9f2f376a9d489e9096386ffec5b7732aa5e3

My future indieweb platform

feat: Use nunjucks templates via koa-nunjucks-next

Alan Pearce
commit

553a9f2f376a9d489e9096386ffec5b7732aa5e3

parent

a00908501a435051cd91c59562d43bb8dd7d56f5

1 file changed, 6 insertions(+), 4 deletions(-)

changed files
M src/index.jssrc/index.js
@@ -8,10 +8,12 @@
const Router = require('koa-router') const router = new Router() -router.get('/', function (ctx, next) { - ctx.status = 200 - ctx.body = 'hello world' - next() +const view = require('koa-nunjucks-next') + +app.use(view(`${__dirname}/views`)) + +router.get('/', async function (ctx, next) { + await ctx.render('index') }) app.use(router.routes()).use(router.allowedMethods())