feat: add render function (#2454)

This commit is contained in:
Luca Casonato
2024-05-24 18:31:34 +02:00
committed by GitHub
parent 82d027cbcd
commit f2162d24bf
14 changed files with 123 additions and 64 deletions
+4 -3
View File
@@ -1,7 +1,8 @@
import type { Handlers, RouteConfig } from "@fresh/core";
import type { RouteConfig } from "@fresh/core";
import { format, parse } from "$std/semver/mod.ts";
import VERSIONS from "../../versions.json" with { type: "json" };
import { extname } from "$std/path/mod.ts";
import { define } from "../utils/state.ts";
const BASE_URL = "https://raw.githubusercontent.com/denoland/fresh/";
@@ -15,7 +16,7 @@ const contentTypes = new Map([
[".wasm", "application/wasm"],
]);
export const handler: Handlers = {
export const handler = define.handlers({
async GET(ctx) {
const accept = ctx.req.headers.get("Accept");
const isHTML = accept?.includes("text/html");
@@ -54,7 +55,7 @@ export const handler: Handlers = {
return response;
},
};
});
export const config: RouteConfig = {
routeOverride: "/@:version/:path*",