https://github.com/oknozor/conversion_api
A small rocket api to convert between weight unit (technical assesment for Climate Seed)
https://github.com/oknozor/conversion_api
Last synced: 2 months ago
JSON representation
A small rocket api to convert between weight unit (technical assesment for Climate Seed)
- Host: GitHub
- URL: https://github.com/oknozor/conversion_api
- Owner: oknozor
- Created: 2022-07-25T07:19:37.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-25T07:48:38.000Z (almost 3 years ago)
- Last Synced: 2025-01-16T22:14:53.214Z (4 months ago)
- Language: Rust
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Conversion API [](https://github.com/oknozor/conversion_api/actions/workflows/CI.yaml)
A REST API exposing a single endpoint to convert between weight units.
This was done as part of a technical assessment for Climate Seed.## Howto
**1. Run:**
`cargo run`**2. Test:**
`cargo test`## Routes
The API expose a single route: `/convert` expecting the following json body :
```json
{
"from": "Unit",
"to": "Unit",
"quantity": "Number"
}
````Unit`: one of "gram", "kilo", "ton" or "lb".
### Example:
1. Start the rocket api: `cargo run`
2. Perform a conversion request:
```sh
curl --request POST \
--url http://127.0.0.1:8000/convert \
--header 'Content-Type: application/json' \
--data '{
"from": "gram",
"to": "lb",
"quantity": 10000
}'
```