It is apparent that you should connect to the NTNU vpn before trying to access any of the web deployed services
10.212.140.185:8080/corona/v1/
<- Assignment 2 Deployment34.89.216.56:8080/corona/v1/
<- Assignment 3 Deployment
Where the service is hosted. If that was not apparant then my apologies.
- Improved File Structure
- DockerFile in main repo Added
- Testing fully implemented to 50-90% coverage
- Implemented comparing local alpha3 country names to cases api
- Stubbing Endpoint deprecated.
- Threading on invocation
- Added comprehensive commenting
This was deployed on google cloud platform, key was transferred using built in upload function. Documentation for Assignment 2 is still valid except stubbing endpoint, which is now deprecated.
run go test .\endpoints\... -cover
from root in order to test all endpoints
All Advanced tasks, and required tasks are implemented
One small change made to the web deployed service is that the constants which contain the directories for the required json files have an extra .
This is because of how its being deployed, the application searches from the file differently and therefore requires it to be so.
However This is not such a big change that requires it to have its own repository for deployment
For recreational purposes heres an example: localhost("./global_types/alpha3.json") -> 10.212.140.185/ 34.89.216.56:8080("../global_types/alpha3.json")
> [08.04.2022 - 06.26] Currently when writing this, the policy api might be online, HOWEVER the stringency data returns data unavailable for every date
Therefore it seems like my application returns Data unavailable
for the policy api, However on the stub documentation i have documented what happens on current date
When the stub was recorded, which was on the [05.04.2022]
[03.05.2022 - 05.56] Currently when writing this, the policy api IS online and working properly compared to last time :)
- All constants are contained within the constants folder
- Contains appConstants, dependConstants, serverConstants
- All Global data types are contained within the global_types folder
- Alpha3 local library is also located here since its a library accessed globally
- Alpha3 local library is also located here since its a library accessed globally
- All endpoints are contained within the endpoints folder
- The endpoints folder also contain common functions for all endpoints
- Testing is also documented within an endpoint
/corona/v1/stubbing/policy/
- The endpoints folder also contain common functions for all endpoints
- All Server functions and caching is contained within the server folder
Here are the dependencies for the project:
- Postman for interracting with the application
- An IDE, we used VSCODE
- Git bash package
- Golang
- FireBase
Deployed on NTNU's OpenStack
serviceAccountKey for firebase was passed to the server using:
scp -i MyKey.pem ./serviceAccountKey.json ubuntu@10.212.140.185:\assignment-2 serviceAccountKey.json
Use go run .\server\server.go
to run from localhost:8080
The default url would therefore be
localhost:8080/corona/v1/
- IT IS REQUIRED THAT YOU CREATE A FOLDER IN assignment-2
FOLDER AND PUT IN YOUR FIREBASE SERVICE KEY AS serviceAccountKey.json
IN ORDER TO RUN IT LOCALLY
0b. Use go run .\server\server.go
to run from localhost:8080
or the already deployed 10.212.140.185:8080
-
GET requests using Postman
- Use
/corona/v1/
withcases/{countryname, or alpha3 code}
,policy/{countryname, or alpha3 code} {?scope=YYYY-MM-DD}
notifications/
in order to see all webhooksnotifications/{webhook_id}
in order to see a specific webhook
- Use
-
POST requests using Postman
-
Use
/corona/v1/
withnotification/
with [raw:JSON] in body in order to create a webhook{ "url": string, "country": string, "calls": int }
-
-
DELETE requests using Postman
- Use
/corona/v1/
withnotification/{webhook_id}
in order to delete that webhook
- Use
Examples: (Using
localhost:8080
or the already deployed10.212.140.185:8080
)
->/corona/v1/stubbing/cases/nor
->/corona/v1/stubbing/cases/norway
->/corona/v1/stubbing/cases<br>
->/corona/v1/stubbing/policy/nor
->/corona/v1/stubbing/policy/norway
->/corona/v1/stubbing/policy/<br>