API Reference
    Preparing search index...
    • Wraps a Router instance to create a Lambda handler that uses response streaming.

      In Lambda runtime, uses awslambda.streamifyResponse to enable streaming responses. In test/local environments, returns an unwrapped handler that works with mock streams.

      Parameters

      • router: Router

        The Router instance to wrap

      • Optionaloptions: ResolveOptions

        Optional configuration including scope for decorator binding

      Returns StreamifyHandler

      A Lambda handler that streams responses

      import { Router, streamify } from '@aws-lambda-powertools/event-handler/http';

      const app = new Router();
      app.get('/test', () => ({ message: 'Hello' }));

      export const handler = streamify(app);
      // With scope for decorators
      class Lambda {
      public scope = 'my-scope';

      @app.get('/test')
      public getTest() {
      return { message: `${this.scope}: success` };
      }

      public handler = streamify(app, { scope: this });
      }