@@ -20,3 +20,40 @@ go build .
2020go test .
2121```
2222
23+ ## Deploy
24+ The deployment is handled through terraform scripts.
25+
26+ Terraform scripts configure the following:
27+ 1 . Go Lambda with the pack calc deployed
28+ 1 . Node Lambda used as an authoriser for the API Gateway
29+ 1 . API Gateway integrated with the pack calc lambda
30+ 1 . A randomly generated token stored as a secure string in ` ParamterStore ` which is used as the auth token
31+
32+ ### API
33+ The API only supports on endpoint as a POST request.
34+
35+ The API body is JSON and should look like this example:
36+ ``` json
37+ {
38+ "items" :501 ,
39+ "packSizes" : [250 ,500 ,1000 ,2000 ,5000 ]
40+ }
41+ ```
42+
43+ Example Request:
44+
45+ ``` bash
46+ curl -X POST --data ' {"items":501, "packSizes": [250,500,1000,2000,5000]}' \
47+ https://jcwz2ki77i.execute-api.eu-west-2.amazonaws.com/calculate-packs -H " Authorization: qD449xM9k0nvK@_f"
48+ ```
49+ ** The auth token is just an example**
50+
51+
52+ ## Notes/ Considerations
53+ 1 . Unfortunately, I did not have enough time to implement a frontend as I was learning golang while implementing the backend
54+ 1 . GitHub Actions have been used to do the following:
55+ 1 . Build and Test the Go Lang Code
56+ 1 . Terraform script validation (` fmt ` , ` init ` and ` validate ` )
57+ 1 . On a PR merge, a GitHub release is created with the compiled Go code attached
58+ 1 . Once a GitHub release is published, a deployment workflow is triggered.
59+ 1 . This workflow will handle the deployment of the resources
0 commit comments