Skip to main content
Module

x/drash/src/services/tengine/tengine.ts

A microframework for Deno's HTTP server with zero third-party dependencies
Go to Latest
File
import { Request, Response, Service } from "../../../mod.ts";import { Jae } from "./jae.ts";
interface IOptions { // deno-lint-ignore camelcase views_path: string;}
export class TengineService extends Service { readonly #options: IOptions; #template_engine: Jae;
constructor(options: IOptions) { super(); this.#options = options; this.#template_engine = new Jae(this.#options.views_path); }
runBeforeResource(_request: Request, response: Response) { response.headers.set("Content-Type", "text/html"); response.render = (filepath: string, data: unknown) => { return this.#template_engine.render(filepath, data); }; }}