Skip to content
15 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 // Only a prefix: enough to tell the test key from the live one.
10 stripeKey: env.STRIPE_KEY ? `${env.STRIPE_KEY.slice(0, 8)}…` : null,
11 });
12 }
13 return env.ASSETS.fetch(request);
14 },
15};