Built with Serverless framework
Before deployment the following ENV variables have to be configured:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
npm run deploy:backend -- -s dev
npm run deploy:database -- -s dev
npm run deploy:api -- -s dev
Get deployment info including keys
sls info -s dev --verbose
To invoke lambda function
sls invoke local -f functionName
sls invoke -f functionName -s dev
To deploy only one lambda function
sls deploy function -f functionName --stage dev --region us-east-1
View lambda function logs
sls logs -f functionName -t
How to run API and unit tests
- Make a copy of .env.example and rename to .env
- Insert your AWS credentials in .env
- Use
npm run test:api
to run the API test - Use
npm test
to run the unit tests
- Root directory - auth and api gateway configuration
- /database - dynamodb config (to be deployed separately)
- /api - appsync config (to be deployed separately)
Before deployment update credentials in docker.env
cp docker.env.example docker.env
bin/dckr build
# deploy stack
bin/dckr npm run deploy:backend -- -s stageName
# deploy a single function
bin/dckr sls deploy function -f resizer --stage stageName --region us-east-1
test
— run unit teststest:api
— run API testsprecommit
— husky precommit hook configurationcheck-types
— check Typescript typingscheck-velocity
— check velocity template syntaxlint
— lint typescript codeformat
— format typescript codelint-schema
— check graphql schemalint-yaml
— validate yaml syntaxdeploy:backend
— deploy xxx-backend: configures Gateway and Cognitodeploy:database
— deploy xxx-db stack: configures Dynamodbdeploy:api
— deploy xxx-api stack: setup Appsync