First of all, make sure you have node.js
installed. You can get it from nodejs.org.
You can install the dependencies using the following commands:
npm install
node_modules/.bin/jspm install
Build the project (default destination is dist
):
npm run build
Use the following command to spin-up a development server at localhost:8080
with watch:
npm run serve
A mock backend server can be launched on 127:0.0.1:3000
using:
npm run json-server
This way the frontend can be tested with real requests to a mock server. JS and JSON files related to the mock server can be found in the json-server
directory.
For more information on the mock server configuration please read the json-server/README.md
file.
The project uses gulp
. Please see the gulp-config.js
and gulpfile.js
to configure the development and build process.
The source folder (considering only the JS part) is structured on a per-realm basis. The site is separated into realms, loosely coupled sections that make up the application. Currently there are 3 (and a half) realms:
- play: the actual game screen
- server: server-specific pages, such as login, server info, registration, and the half-realm, admin
- site: contains no server specific stuff, only informations about the game, docs, tutorials
Each realm has a top-level file which has the same name as the realm. This module returns a getRoutes()
method which returns an array of routes exposed by the realm.
Subdirectires in realms are structured per feature instead of layers/realms to keep together closely related modules even if they belong to different layers.
Contains common components that can be used as building blocks for other, less general components and services that expose utilities for other parts of the application.
A great example for a service is the Request
which handles AJAX requests.
The main.js
file is the entry point of the application which mounts the Mithril SPA to the body
of the HTML page.
routes.js
provides a simple API for storing the routes supported by the application.