I have a gist for a simple Koa server using koa-pug. The working one seems to host the pug file just fine, however, the fail one, which uses koa-mount to forward the app to the root works fine when setting the body but throws
TypeError: ctx.render is not a function
If I change it to something like
ctx.body = "index";
It works fine. Why can't I use koa-pug with koa-mount? Or am I just missing something?
I had to assign Pug to the main app and not the route one...
this.app = new Koa();
this.pug = new Pug({
app: this.app,
viewPath: './src/views'
});
Then everything worked great.