Skip to content

Commit

Permalink
Adds missing description for 'doNotWaitForEmptyEventLoop'
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinBuschmann committed Mar 30, 2024
1 parent 34b25aa commit 635a639
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- [Middlewares](#middlewares)
- [`handleCors`](#handlecors)
- [`inject`](#inject)
- [`doNotWaitForEmptyEventLoop`](#donotwaitforemptyeventloop)
- [`serializeJson`](#serializejson)
- [`parseJson`](#parsejson)
- [`registerHttpErrorHandler`](#registerhttperrorhandler)
Expand Down Expand Up @@ -203,6 +204,22 @@ it('should return created user', async () => {
});
```

### `doNotWaitForEmptyEventLoop`

Sets `context.callbackWaitsForEmptyEventLoop` to false.

From [official documentation](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html):
> callbackWaitsForEmptyEventLoop – Set to false to send the response right away when the callback runs, instead of waiting for the Node.js event loop to be empty. If this is false, any outstanding events continue to run during the next invocation.
```ts
const handler = compose(
types<APIGatewayEvent, Promise<APIGatewayProxyResult>>(),
doNotWaitForEmptyEventLoop(),
)(async (event) => {

});
```

### `parseJson`

`parseJson` is a middleware that parses the request body and extends the event object by a `jsonBody` object:
Expand Down

0 comments on commit 635a639

Please sign in to comment.