Skip to content

Serverless Lambda App porting NodeJS Express app, Cognito auth and API docs

License

Notifications You must be signed in to change notification settings

gssumesh/serverless-express-lambda

Repository files navigation

Setup

Install serverless and apidoc globally: npm -i g serverless npm -i g apidoc

Install other packages : yarn OR npm install

Testing

Execute unit test yarn test OR npm test

Local Development

Local development yarn start OR npm start

Generate API DOCS - generated by comment section

Generating API Documents based on comments apidoc -i src/ -o public/docs

Deployment

After setting AWS credentials in environment, Change Parameter as you feel right. Verify App configuration for stage you are deploying, update file: ./src/config/[YOUR_STAGE]Config.js serverless deploy --stage YOUR_STAGE --region YOUR_REGION --cognitoPoolArn YOUR_USERPOOL_ARN

For example, if your stage is "dev", then

  1. update ./src/config/devConfig.js with correct configuration for that environment.
  2. deploy: serverless deploy --stage dev --region us-west-2 --cognitoPoolArn arn:aws:cognito-idp:us-west-2:[your_account_id]:userpool/[your_userpool_id]

For example, if your stage is "prod", then

  1. update ./src/config/prodConfig.js with correct configuration for that environment.
  2. deploy: serverless deploy --stage prod --region us-west-2 --cognitoPoolArn arn:aws:cognito-idp:us-west-2:xxxxxxx:userpool/somethingBlah