Setu-TS
    Preparing search index...

    Function createFlagGuard

    • Creates a middleware function that guards a route based on a feature flag.

      Resolves IFeatureFlags from the service registry per request, evaluates the flag, and either calls next() (flag on) or short-circuits to a redirect / 404 (flag off).

      When the CAPABILITIES.FEATURE_FLAGS capability is unregistered, the registry's error propagates — the guard does not fail silently.

      Parameters

      • flag: string

        Flag name to evaluate.

      • Optionaloptions: FlagGuardOptions

        Guard options (fallback URL, status code, context override).

      Returns MiddlewareFunction

      A middleware function.

      app.get('/dashboard', [
      createFlagGuard('new-dashboard', { fallback: '/old' }),
      () => c.text('New dashboard'),
      ]);

      If CAPABILITIES.FEATURE_FLAGS is not registered.

      0.1.0