13 Migrating your existing Express.js app to AWS Lambda
This chapter covers
- Running Express.js applications in AWS Lambda and the serverless ecosystem
- Serving static content from an Express.js application
- Connecting to MongoDB from a serverless Express.js application
- Understanding the limitations and risks of Express.js apps in a serverless ecosystem
Express.js is the most important and most used Node.js framework. That’s not without reason: Express.js is easy to use and has a large ecosystem of middleware that can help you build an API or server-rendered web application. But using Express.js still requires a server that will host the application, which means we’re back to the problems this book tries to solve by using serverless technologies. Is there a way to keep your existing Express.js application and still have all the benefits of serverless?
The Express.js web application framework is basically an HTTP server. Serverless applications do not need HTTP servers, because HTTP requests are handled by API Gateway. But fortunately, there is a way to use an existing Express.js application in AWS Lambda with minor modifications. This chapter teaches you how to do that, and it also presents some of the most important limitations of serverless Express.js applications.