https://github.com/yukigeshiki/coding-challenge-rust
Testing out the Axum web framework with a small backend coding challenge.
https://github.com/yukigeshiki/coding-challenge-rust
axum-framework backend-api coding-challenge rust
Last synced: 18 days ago
JSON representation
Testing out the Axum web framework with a small backend coding challenge.
- Host: GitHub
- URL: https://github.com/yukigeshiki/coding-challenge-rust
- Owner: Yukigeshiki
- Created: 2023-08-20T06:36:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-08T08:43:12.000Z (about 1 year ago)
- Last Synced: 2024-04-18T04:59:56.234Z (about 1 year ago)
- Topics: axum-framework, backend-api, coding-challenge, rust
- Language: Rust
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# coding-challenge-rust
[](https://github.com/Yukigeshiki/coding-challenge-rust/actions/workflows/ci.yml) [](https://github.com/Yukigeshiki/coding-challenge-rust/actions/workflows/build.yml)
Create an API server using Axum which will return random animal facts. The service should have the following:
- Receive the following inputs as arguments, environment variables, configuration, etc.
- Port to start on
- Type of fact to return with valid options
- cat
- dog
- any (randomize the type on each request)
- … assume more animals will be added in the future
- Anything else you feel is needed
- Have the endpoint `/fact` return a random fact
- Use the following APIs to retrieve a random cat or dog fact
- Cat → https://alexwohlbruck.github.io/cat-facts/docs/endpoints/facts.html
- Dog → https://kinduff.github.io/dog-api/
- Return a response in this JSON format
```json
{
"fact": "Three of the 12 dogs on the Titanic survived.",
"animal": "dog"
}
```
- Assume this is a production-grade application. So create:- Tests
- Logs
- Handle errors
- etc.
### To run the application:
```
cargo run
```### To test the application:
```
cargo test
```