Moved ui folder
[e-mobility-charging-stations-simulator.git] / src / ui / http / start.ts
CommitLineData
0a48f2b2 1import Bootstrap from '../../charging-station/Bootstrap';
175d4f46
JD
2import express from 'express';
3
4const app = express();
5
6app.get('/', (request, response) => {
7 response.send(`
8
9
10 <form>
11 <input type="button" onclick="window.location.href='/start';" value="Start" />
12 <input type="button" onclick="window.location.href='/stop';" value="Stop" />
13</form>
14
15 `);
16});
17
18app.get('/start', (request, response, next) => {
19 Bootstrap.getInstance().start().catch(next);
20 console.log('*** started');
21 response.send('<b>Started</b><br/><a href="/">Return to Top</a>');
22});
23
24app.get('/stop', (request, response, next) => {
25 Bootstrap.getInstance().stop().catch(next);
26 console.log('*** stopped');
27 response.send('<b>Stopped</b><br/><a href="/">Return to Top</a>');
28});
29
30app.listen(process.env.PORT ?? 8080, () =>
31 console.log(`Listening on port: ${process.env.PORT ?? 8080}`)
32);