Skip to content
16 linesCodeBlameRaw
1// /api says what this deployment was given; everything else is the site.
2export default {
3 async fetch(request, env) {
4 const url = new URL(request.url);
5 if (url.pathname === "/api") {
6 return Response.json({
7 fromConfig: env.FROM_CONFIG ?? null,
8 greeting: env.GREETING ?? null,
9 apiUrl: env.API_URL ?? null,
10 // Only a prefix: enough to tell the test key from the live one.
11 stripeKey: env.STRIPE_KEY ? `${env.STRIPE_KEY.slice(0, 8)}…` : null,
12 });
13 }
14 return env.ASSETS.fetch(request);
15 },
16};