1
0
James Ketrenos 5a16804a7e Create game and persist in memory.
Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
2020-04-21 18:30:20 -07:00
2020-04-10 21:39:46 -07:00
2020-04-21 18:30:20 -07:00
2020-04-21 18:30:20 -07:00
2020-04-20 16:27:15 -07:00
2020-04-04 20:17:39 -07:00
2020-04-20 14:15:21 -07:00
2020-04-20 14:15:21 -07:00
2020-04-20 12:27:58 -07:00
2020-04-04 20:17:39 -07:00
2020-04-20 14:15:21 -07:00
2020-04-21 18:30:20 -07:00
2020-04-20 14:15:21 -07:00
2020-04-04 20:17:39 -07:00
2020-04-20 14:15:21 -07:00
2020-04-04 20:17:39 -07:00

Ketr Settlers

sudo apt-get install nodejs npm
sudo -E npm install --global npm@latest

Ketr.Ketran REST API

POST /api/v1/game

Request

{}

Response

{
  gameId: id
  gameState: {
    tiles: []
    
  }
}

Configuring / installing

Build

git clone ...
cd server
npm install

Install

sudo cp ketr.ketran /etc/logrotate.d/
sudo cp ketr.ketran.service /etc/systemd/system/
sudo systemctl daemon-reload

Install the following into your nginx server configuration:

  location ~ /ketr.ketran/api/.* {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass_header Set-Cookie;
    proxy_pass_header P3P;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://localhost:8930;
  }

Add security tokens in ketr.ketran/config/local.json:

cat << EOF > config/local.json
{
  "tokens": [ {
    "$(whoami)": "$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;)"
  } ]
}
EOF

Launch

sudo systemctl start ketr.ketran

To test

New game

curl -k -s -X POST http://localhost:8911/ketr.ketran/api/v1/games/

Game status

curl -k -s -X GET http://localhost:8911/ketr.ketran/api/v1/games/:id
Description
No description provided
Readme 194 MiB
Languages
TypeScript 86.5%
JavaScript 5.8%
CSS 5.7%
Shell 0.9%
Dockerfile 0.6%
Other 0.5%