This project involved implementing a simple TODO application using AWS Lambda and Serverless framework.
This application will allow creating/removing/updating/fetching TODO items. Each TODO item can optionally have an attachment image. Each user only has access to TODO items that he/she has created.
- Auth0 account
- NodeJS version up to 12.xx
- Serverless
- Create a Serverless account user
- Install the Serverless Framework’s CLI. Refer to the official documentation for more help.
npm install -g serverless serverless --version # Login to your dashboard from the CLI. It will ask to open your browser and finish the process. serverless login # Configure serverless to use the AWS credentials to deploy the application. Provide a pair of Access key (YOUR_ACCESS_KEY_ID and YOUR_SECRET_KEY) of an IAM user with Admin access permissions sls config credentials --provider aws --key YOUR_ACCESS_KEY_ID --secret YOUR_SECRET_KEY --profile serverless
The client
folder contains a web application that can use the API that should be developed in the project.
This frontend should work with your serverless application once it is developed. The only file that you need to edit is the config.ts
file in the client
folder. This file configures the client application.
const apiId = '...' // API Gateway id
export const apiEndpoint = `https://${apiId}.execute-api.us-east-1.amazonaws.com/dev`
export const authConfig = {
domain: '...', // Domain from Auth0
clientId: '...', // Client id from an Auth0 application
callbackUrl: 'http://localhost:3000/callback'
}
To deploy an application run the following commands:
cd backend
npm install
npm install --save-dev serverless-iam-roles-per-function@next
serverless
serverless deploy --verbose
To run a client application first edit the client/src/config.ts
file to set correct parameters. And then run the following commands:
cd client
npm install
npm run start
This should start a development server with the React application that will interact with the serverless TODO application.