deno.land / x / alosaur@v1.1.1 / examples / eta / app.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { 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();
alosaur

Version Info

Tagged at
a year ago