Skip to content

jule256/killergame-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KILLERGAME-SERVER

Setup

Node modules

Install the dependencies with

<machine>:<killergame-folder> <username>$ npm install

MongoDB

Make sure you got a running MongoDB on your system.

Then adapt the default case of the getConnectionString() method in the file config/config.db.js to fit your system's settings.

Start

Start the Killergame-Server with

<machine>:<killergame-folder> <username>$ npm start

You can check if the server is up and running by accessing the ping endpoint with a REST Client (e.g. the RESTClient Addon for Firefox):

GET http://127.0.0.1:3000/ping
Response
    {
        "pong": true,
        "ip": "<your ip address>",
        "time": <current timestamp>
    }

Check the routes/README.md file for a more detailled description of the various endpoints.

Test

Run the UnitTests with

<machine>:<killergame-folder> <username>$ npm test

basic concept

A detailed description of the available routes can be found in the routes/README.md file.

Player 1 (username spieler1) Player 2 (username spieler2)
Login with POST /login Login with POST /login
list all available players with GET /player/available
challenge spieler2 with POST /game
list all games spieler1 is the challenger with GET /game/challenger list all games spieler2 is challenged with GET /game/challengee
accept a challenge with PUT /game/<gameId>/accept
list all accepted challenges with GET /game/accepted
make move with PUT /game/<gameId> waiting spieler1's move by querying GET /game/<gameId>
waiting spieler2's move by querying GET /game/<gameId> make move with PUT /game/<gameId>
spieler1 wins End of game A spieler2 wins
spieler1 gives up with PUT /game/<gameId>/forfeit End of game B spieler2 gives up with PUT /game/<gameId>/forfeit
the game ends draw End of game C the game ends draw

sources

based on https://github.com/kacole2/express-node-mongo-skeleton

authentication system based on https://scotch.io/tutorials/authenticate-a-node-js-api-with-json-web-tokens

unit testing based on https://semaphoreci.com/community/tutorials/getting-started-with-node-js-and-mocha

maybe

chat: https://scotch.io/tutorials/a-realtime-room-chat-app-using-node-webkit-socket-io-and-mean

About

REST API for the killergame

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published