fix: change MultiHandler back to Handlers (#1396)

This commit is contained in:
Marvin Hagemeister
2023-07-03 09:57:46 +02:00
committed by GitHub
parent eb53d53ab8
commit 16be99e69b
32 changed files with 135 additions and 66 deletions
+2 -2
View File
@@ -3,13 +3,13 @@ import Header from "../components/Header.tsx";
import ComponentGallery from "../islands/ComponentGallery.tsx";
import { asset, Head } from "$fresh/runtime.ts";
import { MultiHandler, PageProps } from "$fresh/server.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
function getSource(path: string) {
return Deno.readTextFile(new URL(path, import.meta.url));
}
export const handler: MultiHandler<HomeProps> = {
export const handler: Handlers<HomeProps> = {
async GET(req, ctx) {
const props: HomeProps = {
sources: {
+2 -2
View File
@@ -1,5 +1,5 @@
import { asset, Head } from "$fresh/runtime.ts";
import { MultiHandler, PageProps } from "$fresh/server.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
import { frontMatter, gfm } from "../../utils/markdown.ts";
import Header from "../../components/Header.tsx";
@@ -21,7 +21,7 @@ interface Page extends TableOfContentsEntry {
data: Record<string, unknown>;
}
export const handler: MultiHandler<Data> = {
export const handler: Handlers<Data> = {
async GET(_req, ctx) {
const slug = ctx.params.slug;
if (slug === "") {
+2 -2
View File
@@ -1,4 +1,4 @@
import { MultiHandler } from "$fresh/server.ts";
import { Handlers } from "$fresh/server.ts";
import { gfm } from "../utils/markdown.ts";
// TODO(lucacasonato): hash the file and use the hash as the filename, and serve
@@ -36,7 +36,7 @@ ol.nested li:before {
}
`;
export const handler: MultiHandler = {
export const handler: Handlers = {
GET: () => {
return new Response(CSS, {
headers: {
+2 -2
View File
@@ -1,5 +1,5 @@
import { asset, Head } from "$fresh/runtime.ts";
import { MultiHandler, PageProps } from "$fresh/server.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
import Counter from "../islands/Counter.tsx";
import LemonDrop from "../islands/LemonDrop.tsx";
import Footer from "../components/Footer.tsx";
@@ -18,7 +18,7 @@ function isOpenGraphUA(header: string | null): boolean {
return header.startsWith("Twitterbot") || header.startsWith("Slackbot");
}
export const handler: MultiHandler = {
export const handler: Handlers = {
GET(req, ctx) {
const accept = req.headers.get("accept");
const userAgent = req.headers.get("user-agent");
+2 -2
View File
@@ -1,5 +1,5 @@
import { RouteConfig } from "$fresh/server.ts";
import { MultiHandler } from "$fresh/server.ts";
import { Handlers } from "$fresh/server.ts";
import { parse } from "$std/semver/mod.ts";
import VERSIONS from "../../versions.json" assert { type: "json" };
import { extname } from "$std/path/mod.ts";
@@ -16,7 +16,7 @@ const contentTypes = new Map([
[".wasm", "application/wasm"],
]);
export const handler: MultiHandler = {
export const handler: Handlers = {
async GET(req, ctx) {
const accept = req.headers.get("Accept");
const isHTML = accept?.includes("text/html");
+2 -2
View File
@@ -1,7 +1,7 @@
import { MultiHandler, PageProps } from "$fresh/server.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
import VERSIONS from "../../versions.json" assert { type: "json" };
export const handler: MultiHandler = {
export const handler: Handlers = {
GET(req) {
const accept = req.headers.get("accept");
let path = "/docs/concepts/updating";