Backend API using Node and ExpressJS to perform CRUD operations on users and products. The Database used is PostgreSQL. Used IntelliJ IDE for development. Base64 Authentication is implemented. We publish a message to SNS Topic when an image is created or deleted. Based on this SNS, Lambda function will be triggered
User Routes
GET v1/user/{userId}Get User Account InformationPUT v1/user/{userId}Update User's account informationPOST v1/userCreates a user account (unauthenticated)
Product Routes
GET v1/product/{productId}Get Product Information (unauthenticated)POST v1/productAdd new productPUT v1/product/{productId}Update Product informationPATCH v1/product/{productId}Update Product informationDELETE v1/product/{productId}Delete Product information
Image Routes
GET v1/product/{productId}/imageGet List of All Images UploadedPOST v1/product/{productId}/imageUpload an imageGET v1/product/{productId}/image/{imageId}Get Image DetailsDELETE v1/product/{productId}/image/{imageId}Delete the Image
Health Route
GET /healthzHealth endpoint
git(configured with ssh) [link]node[link]Postmanfor API testing [link]envfile for local Postgres step
- Clone the repository from Organization
git clone git@github.com:CloudComputingSpringCSYE6225/webapp.git
- Install the dependencies
npm i
- Run the program in dev mode
npm run dev
The test cases are written using Jest and Supertest. There are two test cases to test the health and invalid routes respectively.
The command to run the tests is :
npm run test- Go to the packer folder
cd packer - Initialize packer
packer init . - Validate Packer
packer validate . - Format Packer files
packer fmt
- Build Packer
packer build ec2.pkr.hcl
Note : If you want you can add a variables.auto.pkvars.hcl file if you want to provide custom variables other than the default values provided. Additionally, You can source .venv which exports the DB Environment variables and the packer IAM user access keys.