Skip to content
Type for Speed - Server
TypeScript JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
build
client
data
data_sources
src
views
.gitignore
README.md
package-lock.json
package.json
tsconfig.json

README.md

Type for Speed - Server

Run

npm start

The process will launch a HTTP server at localhost which will serve the following (relative) urls:

  • / - The root folder will serve the game client
  • /admin - The server control panel. This requires authentication.

The following environment variables can be configured:

  • PORT - Listening port. Default 5000.
  • TOS_SERVER_AUTH - HTTP Basic Authentication header to access the server control panel. Default is username = "admin", password = "admin".

Build

npm run build or tsc.

Text generation

Texts for the game are stored in the file /data/texts.json. This file can be regenerated by launching the command npm run generate-texts. This script will scan the /data_sources folder for text (*.txt) files. If you want to know how the text are extracted you can take a look at the source file /src/util/generate-texts.ts.

Deployment

Nothing special about deployment, you can simply clone this repository on the target machine and npm install && npm build.

Remember to configure your environment variables and also, if you have your own version of the client, make sure to replace the content of the /client folder. Note that this is not mandatory, as you may serve the client code from another host.

Project structure

  • / - project root
    • src - source TypeScript files
    • build - TypeScript compiler output
    • data - Assets
    • data_sources - Resources to generate assets
    • views - EJS views
    • client - Root folder of the client
You can’t perform that action at this time.