Skip to content
Snippets Groups Projects
Commit 188b7e8f authored by Johannes Borgen's avatar Johannes Borgen
Browse files

Merge branch 'master' of git.gvk.idi.ntnu.no:jobnb/cloudproject

parents c6e51edc c8390316
No related branches found
No related tags found
No related merge requests found
# cloudProject
# CloudProject
Project in Cloud Technologies IMT2681
Project in Cloud Technologies IMT2681<br>
Group members: Job Nestor, Johannes Borgen, Bjørnar Larsen
# ENDPOINTS
## Status
You can view this endpoint by visiting the endpoint /altocumulus/v1/status/
This endpoint returns the http status of the the 2 API's we use as well as checking connectivity with the database.
You can view this endpoint by sending a GET request to: <code>/altocumulus/v1/status/</code>
## Turer
This endpoint takes can take 2 parameters ?limit="int" and &skip="int". If they are not specified it wil set limit to 20 and it wont skip (start at 0)
The endpoint can be reached at /altocumulus/v1/turer
This endpoint returns a list of different routes it takes can take 2 parameters ?limit="int" and &skip="int".
If they are not specified it wil set limit to 20 and it wont skip (start at 0)
The endpoint can be reached by a get request to <code>/altocumulus/v1/turer</code>
## Tur
This endpoint can be reached at /altocumulus/v1/tur/524081f9b8cb77df150007fa.
This endpoint can be reached at <code>/altocumulus/v1/tur/524081f9b8cb77df150007fa</code>.
The string at the end is the id of the trip and can be replaced with any other valid id gotten from for example the turer endpoint
The endpoint provides more information about the route as well as weatherforecast and reviews stored in the database.
brief description of the original project plan, and what has and has not been achieved/changed in the final product
## Review
<code>../altocumulus/v1/review</code>
#### Get
By sending a Get request to the endpoint you wil get all a list of all the reviews from the database.
#### Post
By sending a Post request with a payload you can add a review to the database. Example payload:
<code> {"navn": "Andre", "turid": "524081f9b8cb77df150007fa", "beskrivelse": "Dette var en fin tur", "terningkast": 5} </code>
Navn, turid and beskrivelse has to be a string and terningkast has to be a number between 1 and 6. If you add a review
to the database it wil respond with the reviewID, this can be used to delete.
#### Delete
By sending a Delete request to <code>/altocumulus/v1/review/"ID"</code>, Where id is the string returned in the post endpoint wil delete the review from the Database
## Weather
The weather functions supplements a forecast to a specific tur from /tur endpoint, including temperatures and a listing of rain occurences in a 9 day timeperiod.
The data is derived from Metrologisk institutt (MET) and is under creative common license (https://creativecommons.org/licenses/by/4.0/).
<code>../altocumulus/v1/weather?lat="float64"&long="float64""</code>
### GET
By sending a GET request to the weather endpoint with valid float64 values for latitude and longitude you can get a forecast for a specific location by coordinates.
# Deployment
## Docker
We install docker using the official guidelines for docker repository and latest stable release:
https://docs.docker.com/install/linux/docker-ce/ubuntu/
# Report
###### brief description of the original project plan, and what has and has not been achieved/changed in the final product
We originally wanted to make a IT-security dashboard using various information sources
and twitter to gage the relevance and score of each incident, vulnerability etc.
This proved to be a to daunting of a task for us novice programmers and we changed our scope
to better suit our skills.
Therefore, with limited time and knowledge, we decided to make an API tool for finding and checking
the forecast of different outdoor activities/trips. For this we found APIs from
the Norwegian Nasjonal Turbase (http://www.nasjonalturbase.no/api/) and Metrologisk Institutt
(https://api.met.no/weatherapi/locationforecast/1.9/documentation).
Furthermore, as we implemented these features we decided to add functions for reviewing
these activities/trips to provide more value.
## Report
###### Reflection of what went well and what went wrong with the project
In our project, we tried many different ideas and techniques in GO, in group working,
......@@ -37,13 +82,13 @@ brief description of the original project plan, and what has and has not been ac
on a given day.
What made this difficult was firstly, that we had very few API calls. This, however
was mitigated by one of our group members gaining developer access.
was mitigated by one of our group members gaining a developer token.
The second thing We also struggled with, was converting XML to JSON. This worked out in the end,
as we started to develop procedures to ectract the data and fields that we needed
from the XML file.
Lastly we struggled with getting a good test coverage, as we worte most of the code
Lastly we struggled with getting a good test coverage, as we wrote most of the code
before we wrote the tests.
###### What new has the group learned
......@@ -51,7 +96,7 @@ brief description of the original project plan, and what has and has not been ac
about the challenges faced by developers in their adily lives, and have therefore
understood why we do things a certain way. As well as why we use ceratin workflows.
An couple of exaples on this would be:
An couple of examples on this would be:
* Using branches correctly to be able to develop without destroying someone
elses or your own work.
* Using good ommenting to understand what other team members have done, and also allow
......
......@@ -45,7 +45,7 @@ func StatusHandler(w http.ResponseWriter, r *http.Request) { // Refereed to in m
/**
call to get check statuscode of Nasjonalturbase API
*/
resp, _ := http.Get("http://api.nasjonalturbase.no/turer/524081f9b8cb77df150007fa")
resp, _ := http.Get("http://api.nasjonalturbase.no/turer/524081f9b8cb77df150007fa?api_key=59c5a5cb1eab782445eb12240b311dfa9e186327")
statusData.Nasjonalturbase = resp.StatusCode
if resp != nil {
defer resp.Body.Close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment