Skip to main content
Module

x/alosaur/src/renderer/view.ts

Alosaur - Deno web framework with many decorators
Go to Latest
File
import { renderFile, contentType, Response } from '../package.ts';import { normalize } from '../package.ts';import { getViewRenderConfig } from '../mod.ts';
/** * Renders view with template with changed template render (default .ejs) * @param templatePath * @param model * @param status */export async function View(templatePath: string, model: Object, status: number = 200): Promise<Response> { let body; const headers = new Headers(); headers.set("content-type", contentType("text/html") as string); const renderConfig = getViewRenderConfig(); // if renderConfig.type === dejs body = await renderFile(normalize(`${renderConfig.basePath}${templatePath}.ejs`), model);; return { body, status, headers }}