Skip to content
sproutboatDocs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Vars

Plain-string constants baked into the binary at build time.

Configuration

"vars": { "APP_URL": "https://hello.example.com" }

Usage

export default {
  async fetch(request, env, ctx) {
    return Response.redirect(env.APP_URL, 302); // "https://hello.example.com"
  },
} satisfies ExportedHandler<Env>;

sproutboat types gives a var its literal type, so env.APP_URL is "https://hello.example.com" in the editor. --strict-vars=false types it as string; see Generated types.

Was this page helpful?