Claudia.js is a tool designed to simplify deployment of Node.js projects to AWS Lambda and API Gateway. It automates deployment tasks so you don’t need to worry about introducing errors and configures everything the way you would expect it to be set up out of the box.
In this section, we’ll walk you through setting up an example Node.js and Express.js app to show Claudia.js in action.
Claudia.js is available on npm. The simplest way to use Claudia.js is to install it as a global utility:
npm install -g claudia
Install the Express.js app generator using npm:
npm install express-generator -g express claudia-demo cd claudia-demo npm i
The Express.js app will be hosted by a Lambda function, so it needs a handler to send data between the app and the API Gateway. This is where Claudia.js comes in. Claudia uses aws-serverless-express to generate a helper function to interface between API Gateway requests and Express.js requests and responses.
Execute the command below in your project directory. If you have renamed your Express.js application module, replace app with the name of the main Express.js application module:
$ claudia generate-serverless-express-proxy --express-module app
Your app is now ready to go live:
claudia create --handler lambda.handler \ --deploy-proxy-api \ --region us-east-1