You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,40 @@ const app = require('./app')
37
37
exports.handler=serverlessExpress({ app })
38
38
```
39
39
40
+
## Async setup Lambda handler
41
+
42
+
If your application needs to perform some common bootstrap tasks such as connecting to a database before the request is forward to the API, you can use the following pattern (also available in [this example](https://github.com/vendia/serverless-express/blob/mainline/examples/basic-starter-api-gateway-v2/src/lambda-async-setup.js)):
if (serverlessExpressInstance) returnserverlessExpressInstance(event, context)
67
+
68
+
returnsetup(event, context)
69
+
}
70
+
71
+
exports.handler= handler
72
+
```
73
+
40
74
## 4.x
41
75
42
76
1. Improved API - Simpler for end-user to use and configure.
@@ -208,4 +242,4 @@ On 11/30, the AWS Serverless Express library moved from AWS to [Vendia](https://
208
242
We believe this is the best course of action to ensure that customers using this library get the best possible support in the future. To learn more about this move or become a maintainer of the new Serverless Express library, reach out to us through a GitHub issue on this repository.
0 commit comments