Skip to content

Variable: OnAfterResponse

ts
const OnAfterResponse: (options?) => MethodDecorator;

Defined in: packages/core/src/decorators/lifecycle.decorators.ts:188

Hook called after response is sent

Parameters

ParameterTypeDescription
options?{ before?: boolean; }-
options.before?booleanInsert before other hooks

Returns

MethodDecorator

See

https://elysiajs.com/essential/life-cycle.html#on-after-response

Example

typescript
@Controller('/users')
export class UserController {
  @OnAfterResponse()
  async logResponse(context: Context) {
    console.log(`Response sent: ${context.set.status}`);
  }
}

Released under the MIT License.