.vscode Created a home screen as a start for the actual app. 10 months ago
public Created a home screen as a start for the actual app. 10 months ago
src Created a home screen as a start for the actual app. 10 months ago
style Created a home screen as a start for the actual app. 10 months ago
.gitignore Added interfaces for a persistence layer. 10 months ago
Labyrinth.code-workspace Created base setup of typescript in vs code. 10 months ago
README.MD Added deployment descriptions. 10 months ago
package-lock.json Created a home screen as a start for the actual app. 10 months ago
package.json Created a home screen as a start for the actual app. 10 months ago
tsconfig.json Created an express-graphql server to expose the API as a web API via GraphQL. 10 months ago
tslint.json Removed "endpoint", introduced GameServer to handle logic. 10 months ago
README.MD

Labyrinth

About

Labyrinth is a web API to navigate through a maze.

How to run

Install

Install typescript and tslint globally, if you haven't aready.

npm install -g typescript tslint

Local dependencies:

npm install

Build

Compile TypeScript to JavaScript.

tsc

Executing this in the application's root folder will apply the settings from tsconfig.json.

Run

Run the application.

node dist/app.js

Execute tests

npm test

Deploy

Prepare app

  1. Copy all js files from the dist folder to ther server in /var/www/labyrinth
  2. Copy package.json and package-lock.json too.
  3. Run npm install to get the depencencies.
  4. Change the owner to www-data

Apache

Add the following part to the available site in apache to route requests.

ProxyPass /labyrinth http://localhost:8085
ProxyPassReverse /labyrinth http://localhost:8085

This routing is purely internal. Then after each change reload apache to let the changes take effect.

service apache2 reload

Run service with SystemD

Create the following /etc/systemd/system/labyrinth.service.

[Unit]
Description=A good description

[Service]
PIDFile=/tmp/labyrinth.pid
User=www-data
Group=www-data
Restart=always
KillSignal=SIGQUIT
WorkingDirectory=/var/www/labyrinth/
ExecStart=/usr/bin/node /var/www/labyrinth/app.js

[Install]
WantedBy=multi-user.target

After each change run

systemctl enable labyrinth.service

You can start/stop/show status with

systemctl start/stop/status labyrinth.service