Highly ambitious ATProtocol AppView service and sdks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

debug static serving

+28 -4
+28 -4
frontend/src/routes/static.ts
··· 5 5 const { pathname } = new URL(req.url); 6 6 7 7 if (pathname.startsWith("/static/")) { 8 - return serveDir(req, { 9 - fsRoot: "./src/assets", 10 - urlRoot: "static", 11 - }); 8 + // In production (Docker), the working directory is /app, so assets are at /app/frontend/src/assets 9 + // In development, we're already in the frontend directory, so assets are at ./src/assets 10 + const isDevelopment = Deno.env.get("DENO_ENV") !== "production"; 11 + const fsRoot = isDevelopment ? "./src/assets" : "./frontend/src/assets"; 12 + 13 + try { 14 + // Log for debugging in production 15 + if (!isDevelopment) { 16 + console.log(`[STATIC] Serving ${pathname} from ${fsRoot}`); 17 + 18 + // Check if the file exists 19 + try { 20 + const filePath = `${fsRoot}/${pathname.replace('/static/', '')}`; 21 + await Deno.stat(filePath); 22 + console.log(`[STATIC] File exists: ${filePath}`); 23 + } catch (err) { 24 + console.error(`[STATIC] File not found: ${fsRoot}/${pathname.replace('/static/', '')}`, err); 25 + } 26 + } 27 + 28 + return serveDir(req, { 29 + fsRoot, 30 + urlRoot: "static", 31 + }); 32 + } catch (error) { 33 + console.error(`[STATIC] Error serving ${pathname}:`, error); 34 + return new Response("Internal Server Error", { status: 500 }); 35 + } 12 36 } 13 37 14 38 return new Response("Not Found", { status: 404 });