deligenius / view-engine

🚀A Template View Engine for Deno frameworks
MIT License
54 stars 15 forks source link

Example doesn't work #40

Open wbehrens-on-gh opened 2 years ago

wbehrens-on-gh commented 2 years ago

Copying the demo showed in the readme using handlebars

import { Router } from "oak";
import { handlebarsEngine, oakAdapter, viewEngine } from "view_engine";

const router = new Router();

router.use(
  viewEngine(oakAdapter, handlebarsEngine, {
    viewRoot: <string>`${Deno.cwd()}/views/`,
  }),
);

router.use((ctx) => {
  ctx.render("index.hbs", {});
});

export default router;

ctx.render doesn't exist?

wbehrens-on-gh commented 2 years ago
Task start deno run --allow-net --allow-read src/server.ts
Check file:///home/will/Code/todos/sweet/src/server.ts
error: TS2339 [ERROR]: Property 'render' does not exist on type 'RouterContext<string, ParamsDictionary, Record<string, any>>'.
  ctx.render("index.hbs", {});
gjuoun commented 2 years ago

can you double-check the view-engine version?