[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!

server: handle route in seperate function

Changed files
+11 -8
src
+11 -8
src/user.ts
··· 23 23 web: new WebDidDocumentResolver(), 24 24 }, 25 25 }); 26 + async function getRoute( 27 + did: `did:${"plc" | "web"}:${string}`, 28 + pds: string, 29 + route: string 30 + ): Promise<Response> { 31 + return new Response("404 NOT FOUND: " + route, { 32 + status: 404, 33 + }); 34 + } 26 35 27 36 export default async function ( 28 - _req: Request, 37 + req: Request, 29 38 user: 30 39 | { handle: `${string}.${string}` } 31 40 | { did: `did:plc:${string}` | `did:web:${string}` } ··· 71 80 } 72 81 ); 73 82 74 - pds; 75 - 76 - return new Response(`Resolved: ${"handle" in user ? user.handle : user.did} 77 - 78 - handle: ${"handle" in user ? user.handle : (doc.alsoKnownAs?.filter((x) => x.startsWith("at://"))[0] ?? "N/A")} 79 - did: ${did} 80 - pds: ${pds}`); 83 + return await getRoute(did, pds, new URL(req.url).pathname); 81 84 }