Ranky is a quick prototype of a ranking engine created in javascript, nodejs, and express.
- V0.0.4 Basic ui on / and websocket implementation for broadcasting changes
- v0.0.3 Automatic test data generation when database is empty, now handling teams with arbitrary many players
- v0.0.2 Mongodb storage added. All changes are converted to events which are stored. On server startup all the events are loaded from the databse, and state rebuild
- v0.0.1 Simple api implemented, no storage
The application expects a mongodb running on localhost, and will create a database named ranky with no credentials;
It you want to install mongodb, just run:
$brew install mongodb
$mongod
And the database should be running.
After you have checked out the code and installed node and npm. Just run the following commands from the command line:
$npm install
$node app.js
Point your browser to the root /
There are 3 active endpoints, get the current ranking, create a new player, and register a match.
Post a GET request to /list
Post at POST request to /player containing a JSON body in the following form:
{
"name": "Hans"
}Post at POST request to /match containing a JSON body in the following form, players arrays can contain arbitrary many playerids:
{
"team1": {
"players": [3,5],
"score": 10
},
"team2": {
"players": [1,5],
"score": 3
}
}Connect to the server on the same port as for the api, and receive broadcasts on changes to the list. The possible messages are:
Gets a list of updated players back.
Gets the new player that has been created.