From bf88e7e2275b78d5b03808b5775359973f3358cd Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 6 Apr 2025 18:19:49 -0600 Subject: [PATCH 1/2] use @std/http/unstable-route for Router type --- src/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router.ts b/src/router.ts index 35437c7..ef755a5 100644 --- a/src/router.ts +++ b/src/router.ts @@ -1,4 +1,4 @@ -import { Handler, type Route, route } from "jsr:@std/http"; +import { Handler, type Route, route } from "jsr:@std/http/unstable-route"; import type { GitHubUser } from "./db.ts"; import { getCurrentUser } from "./auth.ts"; From c797c86a7168394dfa234ed9a76447b0253cec68 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 6 Apr 2025 18:21:20 -0600 Subject: [PATCH 2/2] reorder parameters for http handler --- src/main.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 6bbda58..6e15117 100644 --- a/src/main.ts +++ b/src/main.ts @@ -67,7 +67,7 @@ app.get("/links/new", (_req) => { }); }); -app.get("/links/:id", async (_req, _info, params) => { +app.get("/links/:id", async (_req, params, _info) => { const shortCode = params.pathname.groups["id"]; const shortLink = await getShortLink(shortCode); @@ -115,7 +115,7 @@ app.post("/links", async (req) => { }); }); -app.get("/links/:id", async (_req, _info, params) => { +app.get("/links/:id", async (_req, params, _info) => { if (!app.currentUser) return unauthorizedResponse(); const shortCode = params?.pathname.groups["id"]; @@ -129,7 +129,7 @@ app.get("/links/:id", async (_req, _info, params) => { }); }); -app.get("/realtime/:id", (_req, _info, params) => { +app.get("/realtime/:id", (_req, params, _info) => { if (!app.currentUser) return unauthorizedResponse(); const shortCode = params?.pathname.groups["id"]; @@ -174,7 +174,7 @@ app.get("/realtime/:id", (_req, _info, params) => { }); }); -app.get("/:id", async (req, _info, params) => { +app.get("/:id", async (req, params, _info) => { const shortCode = params.pathname.groups["id"]; const shortLink = await getShortLink(shortCode);