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