https://github.com/laudenlaruto/node-rest-api-test
GitHub repository for AWS CodeStar Express.js web service node-rest.
https://github.com/laudenlaruto/node-rest-api-test
amazon-api-gateway aws-cloudformation aws-codebuild aws-codestar aws-lambda expressjs mongodb mongoose nodejs yml
Last synced: about 1 month ago
JSON representation
GitHub repository for AWS CodeStar Express.js web service node-rest.
- Host: GitHub
- URL: https://github.com/laudenlaruto/node-rest-api-test
- Owner: Laudenlaruto
- Created: 2018-03-15T12:21:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-18T11:52:14.000Z (about 7 years ago)
- Last Synced: 2025-02-05T10:50:08.018Z (3 months ago)
- Topics: amazon-api-gateway, aws-cloudformation, aws-codebuild, aws-codestar, aws-lambda, expressjs, mongodb, mongoose, nodejs, yml
- Language: JavaScript
- Size: 179 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Welcome to the AWS CodeStar - Lamda API with node.js and express
------------
This sample code aims to test how CRUD API call work with node.js, express & AWSI 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# What's Here
-----------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# How to use it
------------------
Change **http://host** by the AWS endpoint and **note_id** with a note id.### To list all notes
```
curl http://host/notes
```### To list a single note
```
curl http://host/note/note_id
```### To create a note
```
curl -d '{"title":"Les misérables", "description":"Good book"}' -H "Content-Type: application/json" -X POST http://host/note
```### To update a 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
```### To delete a note
```
curl -X DELETE http://host/note/note_id
```