Of all the things I am a fan of, Serverless is one of them. Needless to say that, serverless in the future and the present. Working with it is super fun and interesting, so I thought of building something that can quickly get you started with it.
Serverless aws-nodejs starter pack with User CURD operations and cognito setup, you will get pre-made user functions for CURD operation with Cognito authorizer, basic Cognito setup, one dummy S3 bucket and function to upload images on S3, DB clients for S3 and dynamoDB with status codes.
Serverless is a vast topic and working with it requires you to write a lot of things from scratch. I made it easier for you, by automating the initial setup. You will get pre-made user functions for CRUD operation with cognito authorizer, Webpack configs, basic cognito setup, one dummy s3 bucket and function to upoad images on s3 and db clients for s3 and dynamodb with status codes.
- User create, update, get, deltete, deactivate functions in DynamoDB table and to delete cognito user
- Cognito authorizer
- Cognito signup login/logout
- One Demo S3 bucket
- Lambda to upload images to S3
- DB and S3 clients
- Cognito client
- Status codes
- Code formatter
- Webpack configs
- Development and production stages
To use this, follow the steps mentioned below. Or, you can fork it and extend it for your personal use case
- To create a new Serverless project:
$ serverless install --url https://github.com/GM1957/serverless-aws-nodejs-initial-setup
- Enter the new directory
$ cd serverless-aws-nodejs-initial-setup
- Install the Node.js packages
$ npm install
- To run a function on your local
$ serverless invoke local -f Users -p ./pathToYour_input.json --stage dev
- To simulate API Gateway locally using serverless-offline
$ serverless offline --stage dev
- Deploy your project in development stage:
$ serverless deploy --stage dev
- Deploy your project in production stage
$ serverless deploy --stage prod
- Deploy a single function in development
$ serverless deploy FunctionName --stage dev
Run your check using the command below. (Presently, there is only the code format checker test)
$ npm run formatCheck
Format all the codes with pritter formatter:
$ npm run format