fix: ensure the ATG will start from its saved status
[e-mobility-charging-stations-simulator.git] / ui / web / start.js
CommitLineData
10687422
JB
1const http = require('node:http'),
2 path = require('node:path'),
3 { env } = require('node:process'),
cbac2373 4 finalhandler = require('finalhandler'),
32de5a57
LM
5 serveStatic = require('serve-static');
6
10687422
JB
7const isCFEnvironment = env.VCAP_APPLICATION !== undefined,
8 PORT = isCFEnvironment ? parseInt(env.PORT) : 3030,
efdd1922 9 uiPath = path.join(__dirname, './dist');
32de5a57
LM
10
11const serve = serveStatic(uiPath);
12
13const server = http.createServer(function onRequest(req, res) {
14 serve(req, res, finalhandler(req, res));
15});
16
efdd1922 17server.listen(PORT, () => console.info(`App running at: http://localhost:${PORT}`));