first pass at assessment

This commit is contained in:
jeff
2025-06-04 15:28:56 -07:00
parent ce57f022d4
commit 9a3610cc7c
4 changed files with 121 additions and 1 deletions

View File

@ -19,3 +19,39 @@ From recruiter:
> * We do not expect a production-ready service, but you might want to comment on your shortcuts.
> * The submitted project should build and have brief instructions so we can verify that it works.
> * You may write in whatever language or stack you're most comfortable in
This HTTP service gets a short forecast (results in JSON) for a given latitude and longitude.
### Build requirements
A local installation of Go is needed. Instructions to install Go can be found here: https://go.dev/learn/. I've used Ubuntu, but any OS should work.
### Building and Running
In the top-level-directory, run the following command:
`go build main.go`
This will build a binary in that folder, which can be run without arguments.
`./main`
To call the endpoint, use an HTTP client to send a GET request to `localhost:8080/forecast`. The payload should look like this:
```json
{
"latitude": 48.29944,
"longitude": -116.56
}
```
The result should look like this:
```json
{
"shortForecast": "Mostly Sunny",
"temperature": "hot"
}
```
### Shortcuts
* This should be containerized in something like Docker
* The code is all in main.go, but if this project was to grow, it should be broken down.
* There are no tests, but `httptest` should be used to test this. With rules, the temperature could be tested as well.
* Logging is sparse, but should be enough to test for this assessment.