Skip to main content
Module

x/alosaur/examples/eta/app.ts

Alosaur - Deno web framework with many decorators
Very Popular
Go to Latest
File
import { configure, renderFile } from "https://deno.land/x/eta@v1.9.0/mod.ts";import { App, Area, Controller, Get, QueryParam, View } from "alosaur/mod.ts";
const viewPath = `${Deno.cwd()}/examples/eta/views/`;
@Controller("")export class HomeController { @Get("/") text(@QueryParam("name") 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();