Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
devill committed Mar 4, 2014
1 parent 4d70d04 commit cba01af
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
express.pid
.idea
node_modules
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
url: http://localhost:1337/
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "poker-player-javascript",
"description": "Javascript player from lean poker. http://leanpoker.org",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "3.x"
}
}
11 changes: 11 additions & 0 deletions player.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

module.exports = {

bet_request: function(game_state) {
return 0;
},

showdown: function(game_state) {

}
};
24 changes: 24 additions & 0 deletions player_service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var player = require('./player');
var express = require('express');
var app = express();

app.use(express.json());
app.use(express.urlencoded());

app.get('/', function(req, res){
res.send(200, 'OK')
});

app.post('/', function(req, res){
if(req.body.action == 'bet_request'){
res.send(200, player.bet_request(req.body.game_state).toString());
}
if(req.body.action == 'showdown'){
player.showdown(req.body.game_state);
res.send(200, 'OK');
}
});

port = 1337;
app.listen(port);
console.log('Listening at http://localhost:' + port)
7 changes: 7 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
nodejs player_service.js &

echo $! > express.pid
8 changes: 8 additions & 0 deletions stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR

kill `cat express.pid`
rm express.pid

0 comments on commit cba01af

Please sign in to comment.