-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It Works!!!, need test and Terraform scripts updates
- Loading branch information
Showing
11 changed files
with
127 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
/terraform/.terraform | ||
/terraform/.terraform | ||
/.aws-sam | ||
/main | ||
/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
compile_lambda: | ||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main main.go | ||
set GOOS=linux&& set GOARCH=amd64&& set CGO_ENABLED=0&& go build -o main main.go | ||
start_db: | ||
docker run -d --name dynamodb -p 8000:8000 amazon/dynamodb-local | ||
create_table: | ||
aws dynamodb create-table \ | ||
--table-name products \ | ||
--attribute-definitions \ | ||
AttributeName=ProductID,AttributeType=S \ | ||
--key-schema \ | ||
AttributeName=ProductID,KeyType=HASH \ | ||
--provisioned-throughput \ | ||
ReadCapacityUnits=5,WriteCapacityUnits=5 \ | ||
--endpoint-url http://localhost:8000 | ||
stop_db: | ||
docker stop dynamodb | ||
docker rm dynamodb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Serverless Api Scraper | ||
|
||
Serverless API. Scrape data from a supermarket website and store it in a dynamoDB database. | ||
|
||
- `[GET] /api/v1/products` - Get all products | ||
|
||
```json | ||
{ | ||
"code": 200, | ||
"status": "OK", | ||
"message": "Success getting all products", | ||
"data": [ | ||
{ | ||
"product_id": "uuid", | ||
"name": "Producto 1", | ||
"category": "category 1", | ||
"original_price": 899, | ||
"discounted_price": 0 | ||
}, | ||
{ | ||
"product_id": "uuid", | ||
"name": "Producto 2", | ||
"category": "category 2", | ||
"original_price": 999, | ||
"discounted_price": 0 | ||
} | ||
] | ||
} | ||
``` | ||
|
||
- `[GET] /api/v1/products/{ProductID}` - Get a product by ID | ||
|
||
```json | ||
{ | ||
"code": 200, | ||
"status": "OK", | ||
"message": "Success getting product", | ||
"data": { | ||
"product_id": "uuid", | ||
"name": "Producto 1", | ||
"category": "category 1", | ||
"original_price": 899, | ||
"discounted_price": 0 | ||
} | ||
} | ||
``` | ||
|
||
- `[POST] /api/v1/products` - Update Data (this will take a while, 1 min aprox) | ||
|
||
```json | ||
{ | ||
"update_data" : true | ||
} | ||
``` | ||
|
||
```json | ||
{ | ||
"code": 200, | ||
"status": "OK", | ||
"message": "Success updating data", | ||
"data": null | ||
} | ||
``` | ||
|
||
- Use Terraform to deploy the infrastructure. | ||
- Tested with SAM CLI (Serverless Application Model Command Line Interface) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters