Major bug fix

This commit is contained in:
AndrewTrieu
2023-03-10 16:41:57 +02:00
parent 4c8e7e8588
commit 0fab2411ee
19 changed files with 965 additions and 19 deletions

View File

@@ -1,11 +1,19 @@
import { configure, renderFile } from "../deps.js";
const renderMiddleware = async (context, next) => {
configure({
views: `${Deno.cwd()}/views/`,
});
configure({
views: `${Deno.cwd()}/views/`,
});
const renderMiddleware = async (context, next) => {
context.render = async (file, data) => {
if (!data) {
data = {};
}
if (context.user) {
data.user = context.user;
}
context.response.headers.set("Content-Type", "text/html; charset=utf-8");
context.response.body = await renderFile(file, data);
};