blob: 337be7f5af0a929231af2d9e7793716c913b0098 [file] [log] [blame]
j50502062022-01-24 19:25:49 -08001/**
2 * @file DTPS development server
3 * @author jottocraft
4 *
j6e1a7bf2026-10-13 03:37:04 +00005 * @copyright Copyright (c) jottocraft 2020
j50502062022-01-24 19:25:49 -08006 * @license MIT
7 */
8
9const express = require('express');
10const app = express();
11
12var port = 2750;
13
14//Check CLI args
15process.argv.forEach(arg => {
16 if (arg.startsWith("--port=")) {
17 port = Number(arg.replace("--port=", ""));
18 }
19})
20
21//Serve dev
22app.get('/dtps/dev', function(req, res) {
23 res.send(true);
24});
25
26//Serve scripts
27app.use('/scripts', express.static('scripts'));
28
jdc6ea0e2022-04-26 16:03:27 -070029//Serve root-level script
j50502062022-01-24 19:25:49 -080030app.use('/init.js', express.static('init.js'));
jdc6ea0e2022-04-26 16:03:27 -070031
32//Serve UI files
33app.use('/dtps.css', express.static('ui/dtps.css'));
34app.use('/fluid/fluid.css', express.static('ui/fluid.css'));
35app.use('/fluid/fluid.js', express.static('ui/fluid.js'));
j50502062022-01-24 19:25:49 -080036
37//Serve www
38app.use('/', express.static('www'));
39
40app.listen(port, () => {
41 console.log("The Power+ development server is listening on port " + port);
42 console.log("\nGo to Settings -> About -> Advanced Options -> Enable debug config in Power+ to enable debug mode");
43 console.log("Read CONTRIBUTING.md for more information");
44});