To start the program, run: `npm start`.
+To start the program with a UI controller, run: `npm start:server`.
+Then, start/stop the simulator connections by going to `https://<hostname:port>` in a browser.
+
## Docker
In the [docker](./docker) folder:
"prepare": "node prepare.js",
"prestart": "npm run build",
"start": "cross-env NODE_ENV=production node -r source-map-support/register dist/start.js",
+ "start:server": "npm run build && cross-env NODE_ENV=production node -r source-map-support/register dist/http/start.js",
"start:debug": "cross-env NODE_ENV=production node -r source-map-support/register --inspect dist/start.js",
"start:dev": "npm run build:dev && cross-env NODE_ENV=development node -r source-map-support/register dist/start.js",
"start:dev:debug": "npm run build:dev && cross-env NODE_ENV=development node -r source-map-support/register --inspect dist/start.js",
"@mikro-orm/mariadb": "^4.5.10",
"@mikro-orm/reflection": "^4.5.10",
"@mikro-orm/sqlite": "^4.5.10",
+ "@types/express": "^4.17.13",
"basic-ftp": "^4.6.6",
"chalk": "^4.1.2",
+ "express": "^4.17.3",
"mongodb": "^4.4.1",
"poolifier": "^2.2.0",
"proper-lockfile": "^4.1.2",
const isDevelopmentBuild = process.env.BUILD === 'development';
export default {
- input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
+ input: ['src/start.ts', 'src/http/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
output: {
dir: 'dist',
format: 'cjs',
'basic-ftp',
'chalk',
'crypto',
+ 'express',
'fs',
'@mikro-orm/core',
'@mikro-orm/reflection',
--- /dev/null
+import Bootstrap from '../charging-station/Bootstrap';
+import express from 'express';
+
+const app = express();
+
+app.get('/', (request, response) => {
+ response.send(`
+
+
+ <form>
+ <input type="button" onclick="window.location.href='/start';" value="Start" />
+ <input type="button" onclick="window.location.href='/stop';" value="Stop" />
+</form>
+
+ `);
+});
+
+app.get('/start', (request, response, next) => {
+ Bootstrap.getInstance().start().catch(next);
+ console.log('*** started');
+ response.send('<b>Started</b><br/><a href="/">Return to Top</a>');
+});
+
+app.get('/stop', (request, response, next) => {
+ Bootstrap.getInstance().stop().catch(next);
+ console.log('*** stopped');
+ response.send('<b>Stopped</b><br/><a href="/">Return to Top</a>');
+});
+
+app.listen(process.env.PORT ?? 8080, () =>
+ console.log(`Listening on port: ${process.env.PORT ?? 8080}`)
+);