docs: update Fresh 2 migration info (#3161)

This commit is contained in:
Marvin Hagemeister
2025-07-31 10:46:44 +02:00
committed by GitHub
parent c08710f7dd
commit 62f8bb008e
7 changed files with 28 additions and 29 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
import type { FreshContext } from "fresh";
import type { Context } from "fresh";
import type { Event } from "$ga4";
import { GA4Report, isDocument, isServerError } from "$ga4";
@@ -6,9 +6,9 @@ const GA4_MEASUREMENT_ID = Deno.env.get("GA4_MEASUREMENT_ID");
let showedMissingEnvWarning = false;
function ga4(
function ga4<T>(
request: Request,
conn: FreshContext,
conn: Context<T>,
response: Response,
_start: number,
error?: unknown,
@@ -87,8 +87,8 @@ function ga4(
});
}
export async function handler(
ctx: FreshContext,
export async function handler<T>(
ctx: Context<T>,
): Promise<Response> {
let err;
let res: Response;
+2 -4
View File
@@ -1,13 +1,11 @@
import type { FreshContext } from "fresh";
import type { Context } from "fresh";
const REDIRECTS: Record<string, string> = {
"/docs/getting-started/fetching-data":
"/docs/getting-started/custom-handlers",
};
export async function handler(
ctx: FreshContext,
) {
export async function handler<T>(ctx: Context<T>) {
// Redirect from old doc URLs to new ones
const redirect = REDIRECTS[ctx.url.pathname];
if (redirect) {