0.1.0 • Published 5 years ago

node-lambda-starter v0.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

Getting started

To use this starter repo, download a ZIP above. Do not fork this repo.

  • Update the package name in package.json (this is used in the deployment and should match the new repo name)
  • Delete the claudia.json file so that you can create a fresh Lambda instance and API Gateway
  • Run npm i to install all dependencies

Once you have all the dependencies installed locally you can use the following commands:

  • npm start - Run a local development server
  • npm test - Execute all unit tests (any file ending in .spec.js)

Deploying

The first deployment will need to be run locally. Afterwards, TravisCI will handle deployments during the build as long as it is on either the master (Production) or development (Beta) branch. You will need to have AWS access in order to continue.

The following command will create a new Lambda and API Gateway instance for this app. This command will fail if the claudia.json file has not been deleted:

claudia create --handler lambda.handler --deploy-proxy-api --region us-east-1

If you are not logged into AWS or don't have an AWS profile locally, you can set environment variables to run this command with your Key and Secret. An IAM user has already been created for this type of deployment, ask if you don't have the access key:

AWS_ACCESS_KEY_ID="AK************A" \
AWS_SECRET_ACCESS_KEY="Li************5" \
npx claudia create --handler lambda.handler --deploy-proxy-api --region us-east-1

The access key and secret will need to be added as environment variables in TravisCI for the main branch deploys to succeed.