https://github.com/mashiike/restrating
REST full Rating microservice
https://github.com/mashiike/restrating
Last synced: 3 months ago
JSON representation
REST full Rating microservice
- Host: GitHub
- URL: https://github.com/mashiike/restrating
- Owner: mashiike
- License: mit
- Created: 2019-06-09T16:23:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-14T19:47:49.000Z (almost 6 years ago)
- Last Synced: 2024-05-01T16:15:24.776Z (about 1 year ago)
- Language: Go
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# restrating
[](https://circleci.com/gh/mashiike/restrating)REST full Rating microservice
now development...
```
[github.com/mashiike/rastrating/cmd/api]$ go run .
[restrating] 04:43:47 HTTP "CreatePlayer" mounted on POST /v1/players
[restrating] 04:43:47 HTTP "ApplyMatch" mounted on POST /v1/matches
[restrating] 04:43:47 HTTP server listening on "localhost:8088"
```/v1/players
```
$ curl -X POST -H 'Content-Type:application/json' -d '{"name":"goat"}' http://localhost:8088/v1/playe
rs | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 41 100 26 100 15 3991 2302 --:--:-- --:--:-- --:--:-- 4333
{
"rrn": "rrn:player:goat"
}
```/v1/matches
```
$ curl -X POST -H 'Content-Type:application/json' -d '{"scores":{"rrn:player:sheep":1.0, "rrn:player:goat":0.0}}' http://localhost:8088/v1/matches | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 274 100 216 100 58 38883 10441 --:--:-- --:--:-- --:--:-- 43200
{
"participants": [
{
"rrn": "rrn:player:sheep",
"rating": {
"strength": 1664.29,
"lower": 1080.13,
"upper": 2248.45
}
},
{
"rrn": "rrn:player:goat",
"rating": {
"strength": 1335.7,
"lower": 751.5400000000001,
"upper": 1919.8600000000001
}
}
]
}
```