This is an example repository for running AdonisJS on AWS Lambda. Work on this project has been done by @satheler with his package s12r and @capopovici by making it compatible with version 5.1.9 of AdonisJS.
Install the s12r package.
Using yarn:
yarn add @satheler/s12r
Using npm:
npm install @satheler/s12r
Install the serverless-plugin-typescript serverless plugin.
Using yarn:
yarn add serverless-plugin-typescript
Using npm:
npm install serverless-plugin-typescript
Copy lambda.ts to your project.
If you do not have a serverless.yml configuration already, you can copy the one from the repository and change a few values like:
- service
- region
- stage
- environment variables
Add additional compilerOptions
:
"baseUrl": ".",
"preserveConstEnums": true,
"strictNullChecks": true,
"target": "ESNext",
"moduleResolution": "node",
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"noUnusedParameters": true,
"removeComments": true,
"declaration": false,
"lib": [
"ESNext"
],
"outDir": ".build",