t3-code-android-nightly/.repos/alchemy-effect/packages/frontend-frameworks/fixtures/octane/octane.config.ts
Julius Marminge e3c85ead63
chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-17 23:21:25 -07:00

34 lines
1.1 KiB
TypeScript

import { cloudflare } from "@octanejs/adapter-cloudflare";
import { defineConfig, RenderRoute, ServerRoute } from "@octanejs/vite-plugin";
/**
* The Cloudflare request context the adapter forwards as `context.platform`
* in production. In dev, Octane's Vite middleware supplies no platform
* (upstream limitation), so handlers must tolerate `undefined`.
*/
interface Platform {
readonly env?: Record<string, unknown>;
readonly ctx?: { readonly waitUntil?: unknown };
}
export default defineConfig({
adapter: cloudflare(),
router: {
routes: [
new ServerRoute({
path: "/api/hello",
methods: ["GET"],
handler: (context) => {
const platform = context.platform as Platform | undefined;
return Response.json({
marker: "api-route-ok",
secret:
(platform?.env?.FIXTURE_SECRET as string | undefined) ?? null,
hasWaitUntil: typeof platform?.ctx?.waitUntil === "function",
});
},
}),
new RenderRoute({ path: "/", entry: ["App", "/src/App.tsx"] }),
],
},
});