Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
cparks1 committed May 12, 2024
1 parent 6c76fa1 commit c2d49a8
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,37 @@ This will start the Flask development server, typically accessible at `http://12

**Note:** In production environments, you'll want to set the `DEBUG_MODE` environment variable to `FALSE`.

## Querying the `/time` endpoint
The `/time` endpoint only allows `GET` requests, and takes a single optional parameter named `timezone`.

The `timezone` parameter should be of format `+/-HH:MM` representing the required amount of hours and minutes offset. The hours should be no larger than 14, and the minutes should be no larger than 59.

A success response will have status code 200 and return JSON like this, when given no timezone parameter:
```json
{
"currentTime": "2024-05-12T04:47:34Z",
"error": null
}
```

A success response will have status code 200 and return JSON like this, when given a timezone parameter:
```json
{
"adjustedTime": "2024-05-12T13:02:09-04:00",
"currentTime": "2024-05-12T17:02:09Z",
"error": null
}
```

An error response from the `time` endpoint will have an `error` field in the JSON response body that is not null, and have a status code other than 200.

Here is an example error response when given an invalid timezone offset:
```json
{
"error": "Invalid timezone format. Use format '+/-HH:MM'"
}
```

# Running Unit Tests
The project includes unit tests written using the pytest framework. To run the tests, ensure you have pytest installed (pip install pytest). Then, from the project directory, run the following command:
```
Expand Down

0 comments on commit c2d49a8

Please sign in to comment.