This sample code aims to test how CRUD API call work with node.js, express & AWS
I built a simple API to manipulate notes, title and description. Technologies used:
- AWS Codestar for pipeline integration
- AWS Lambda
- AWS API gateway
- Mongodb Atlas cloud database
This sample includes:
- README.md - this file
- buildspec.yml - this file is used by AWS CodeBuild to package services for deployment to AWS Lambda
- app.js - this file contains the Node.js code for the API logique
- db.js - this file contaons the logique to connect to Mongodb database
- index.js - this file contains the AWS Lambda handler code
- template.yml - this file contains the AWS Serverless Application Model (AWS SAM) used by AWS CloudFormation to deploy services to AWS Lambda and Amazon API Gateway.
- tests/ - this directory contains unit tests for your application - not yet implemented
Change http://host by the AWS endpoint and note_id with a note id.
curl http://host/notes
curl http://host/note/note_id
curl -d '{"title":"Les misérables", "description":"Good book"}' -H "Content-Type: application/json" -X POST http://host/note
curl -d '{"title":"Les misérables", "description":"Not so good of a book"}' -H "Content-Type: application/json" -X PATCH http://host/note/note_id
curl -X DELETE http://host/note/note_id