diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/index.js | 10 | ||||
-rw-r--r-- | src/views/index.html | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/index.js b/src/index.js index 9ba74de..630ac08 100644 --- a/src/index.js +++ b/src/index.js @@ -8,10 +8,12 @@ const app = new Koa() 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()) diff --git a/src/views/index.html b/src/views/index.html new file mode 100644 index 0000000..3b18e51 --- /dev/null +++ b/src/views/index.html @@ -0,0 +1 @@ +hello world |