deno.land / x / alosaur@v1.1.1 / examples / eta / app.ts
12345678910111213141516171819202122232425262728293031323334import { configure, renderFile } from "https://deno.land/x/eta@v1.9.0/mod.ts";import { ActionParam, App, Area, Controller, Get, QueryParam, View } from "alosaur/mod.ts";
const viewPath = `${Deno.cwd()}/examples/eta/views/`;
@Controller("")export class HomeController { @Get("/") @ActionParam(0, QueryParam("name")) text(name: string) { return View("main", { name }); }}
@Area({ controllers: [HomeController],})export class HomeArea {}
const app = new App({ areas: [HomeArea],});
// Configure Etaconfigure({ views: viewPath, async: true });
app.useViewRender({ type: "eta", basePath: viewPath, getBody: async (path: string, model: Object) => await renderFile(path, model),});
app.listen();
Version Info