This Node JS server hosts a website that handles check-in and -out of scout patrols for the Danish scout competitions CCMR, Invictus and Arcus. It can be setup to handle any number of locations and patrols. Routes between locations control how patrols can move between locations. Thus, any competition where a patrols next location is known at check-out from the previous is supported. Locations may circle back on each other or be linearly ordered.
Webspejd is a small TypeScript/Node.js application for managing check‑in and ‑out of scout patrols during competitions. The TypeScript source code lives in the src folder and compiles to target. All state is stored in a single SQLite database, including locations, patrols, routes, and check‑in / ‑out events.
When running, the server host multiple sites:
- a login page
- a check-in and out page for each location
- Master page to manage locations, patrols and check‑ins / ‑outs
- Install NodeJS if not already on system.
- Run
npm installin root of project - Compile the project by running
npm run buildin root of project. - Setup configuration file and database as described in Setup of server
- Run the server
npm run start - Acces server at the address and port set in configuration file.
Before the server can be started, a configuration file must be created and the database must be created.
A configuration file named server.config.json must be created in the root of the project. An example configuration file is shown below.
{
"port": 3000,
"address": "127.0.0.1",
"databasePath": "SQLite/webspejd.db",
"assetsPath": "assets/",
"inMemory": false,
"resetDatabase": false,
"master_password": "example_password"
}The configuration file contains the following settings:
port: The port the server listens on.address: The address the server listens on. Use"localhost"or127.0.0.1for local access. Use the computer's IP address for network access.databasePath: The path to the SQLite database file.assetsPath: The path to the assets folder containing images, CSS and JS files. Usually this is set toassets/.inMemory: If true, the database is created in memory and not saved to disk. Useful for testing.resetDatabase: If true, the database is reset on server start. Useful for testingmaster_password: The master password used to access the master page.
To create the database run npm run generateDatabase if project is build or npm run generateDatabase:ts if source is used. This generates SQLite at the location set in configuration file with correct tables and settings.