A simple Crypto server that supports below URI's
curl http://localhost:8080/currency/btcusd
curl http://localhost:8080/currency/ethbtc
curl http://localhost:8080/currency/all
Run below commands
go get https://github.com/basicsbeauty/crypto-server
cd crypto-server
go run main.go
- Server configuration is driven by a JSON file,
config.json
- Support for parameters {port number, source API URL, supported tickers}
- Websocket implementation to keep the data in sync
- Used local cache to store and serve requests
- Used native HTTP library for handling REST API calls
- Handled corner cases, the server only responds to GET calls for /currency/
- Developed separate modules for {config, pricing data, websocket communication} for modularity
- Unit tests
Used gorilla/websocket library for handling web socket network IO for better reliability and its battle-tested.