https://github.com/tomcyr/kryptonim-example
https://github.com/tomcyr/kryptonim-example
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tomcyr/kryptonim-example
- Owner: tomcyr
- Created: 2025-02-23T21:14:03.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-24T09:10:53.000Z (4 months ago)
- Last Synced: 2025-02-24T10:24:05.614Z (4 months ago)
- Language: Go
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Example project written in go using gin-gonic
Endpoint rates:
```
GET /rates?currencies=EUR,GBP
```Example response:
```json
[
{ "from": "EUR", "to": "GBP", "rate": 1.0 },
{ "from": "GBP", "to": "EUR", "rate": 1.0 }
]
```returns rates for all currency pairs: EUR-GBP, GBP-EUR fetched from openexchangesrates.org API.
Endpoint exchange:
```
GET /exchange?from=WBTC&to=USDT&amount=1.0
```Example response:
```json
{"from": "WBTC", "to": "USDT", "amount": 57094.314314}
```How to run:
```bash
cp dev.env .env
```Create APP ID on openexchangesrates.org website (registration is needed)
Paste your APP ID into .env file (variable OPEN_EXCHANGE_RATES_APP_ID).
Build docker image:
```bash
make build-image
```Run docker image:
```bash
make run-image
```Test:
```bash
curl "localhost:8080/rates?currencies=EUR,GBP"
```