Files
sweet/tests/fixture_server_components/routes/context/[id].tsx
T
Reed von Redwitz 82c75f85e9 fix: update dependency recommendations (#2320)
closes https://github.com/denoland/fresh/issues/2319

The issue is because `imports.ts` wasn't changed before releasing. I
thought I would go through and bump some other versions as well. This
handles everything except the esbuild stuff and `tests/`.
2024-02-19 10:33:04 +01:00

22 lines
706 B
TypeScript

import { RouteContext } from "../../../../server.ts";
import { delay, relative, SEPARATOR } from "../../../deps.ts";
export default async function Foo(_req: Request, context: RouteContext) {
await delay(1);
const value = JSON.stringify(context, (key, value) => {
if (key === "outDir" || key == "staticDir") {
return relative(Deno.cwd(), value).split(SEPARATOR).join("/");
} else if (key === "entrypoints") {
return {};
}
if (typeof value === "function") return value.constructor.name;
if (value === undefined) return "<undefined>";
return value;
}, 2);
return new Response(value, {
status: 200,
headers: { "Content-Type": "application/json" },
});
}