Boilerplate to automate express-js deployment with typescript for aws-lambda.
You need to have node 14x version installed on your computer.
-
To get started clone this repository using -
git clone https://github.com/sachink23/express-lambda-starter
-
Set the name of your package, repository in package.json
-
Set deployment configuration for lambda deployment in deployment.config.json
-
Install npm dependencies using npm install in the root directory of project
npm install
-
Now you can start coding your express with typescript in src/app.ts
-
To Start development server use
npm run dev
- By default, development server will start on port 8000
-
To build the project use
npm run build
- Build files are stored in the dist/ directory
- The function to deploy is stored in dist/index.js
-
You can deploy project from your computer or setup your continuous deployment pipeline to deploy on every pull request using github actions.
-
For deployment configuration use deoloyment-config.json
-
Deploy From your local computer
- To deploy locally you must have environment variables set as follows -
AWS_ACCESS_KEY_ID = YOUR_AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY = YOUR_AWS_SECRET_FOR_ACCESS_KEY
- Once you have successfully set the environment variables build and deploy the project
npm run build && npm run deploy
- To deploy locally you must have environment variables set as follows -
-
Deploy Using Github Actions
-
To deploy using github actions set the following secrets for your cloned repository in github
AWS_ACCESS_KEY_ID = YOUR_AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY = YOUR_AWS_SECRET_FOR_ACCESS_KEY
-
-
You can also use serverless-framework for easier deployment