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
Languages
TypeScript
86.5%
JavaScript
5.8%
CSS
5.7%
Shell
0.9%
Dockerfile
0.6%
Other
0.5%