Skip to main content

useEnvironment

Overview

useEnvironment

useEnvironment<BoundEnvironmentAliases>(bindingAlias): `BoundEnvironmentAliases`[keyof `BoundEnvironmentAliases`]

Hook for consuming the environment bindings associated with the current request.

The value of this context is derived from your application's runtime:

  • Cloudflare Workers: env object passed from the current request.
  • Deno: Deno.env.toObject().
  • Node.js: process.env.

Type parameters

NameType
BoundEnvironmentAliases{}

Parameters

NameType
bindingAliaskeyof BoundEnvironmentAliases

Returns

BoundEnvironmentAliases[keyof BoundEnvironmentAliases]

Defined in

hooks/EnvironmentContext.ts:34