X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=ui%2Fweb%2Fstart.js;h=99a794d5af59c699674895225e03bf921bfa192b;hb=f36c2478a92ea04a096232c4060427438ad2cd79;hp=39cdf0f446d338a700f2f22763ff2193b3d2187f;hpb=464d3e1aec162bc71f36399f575060cfa098dcbf;p=e-mobility-charging-stations-simulator.git diff --git a/ui/web/start.js b/ui/web/start.js index 39cdf0f4..99a794d5 100644 --- a/ui/web/start.js +++ b/ui/web/start.js @@ -1,18 +1,18 @@ -import { createServer } from 'node:http'; -import { dirname, join } from 'node:path'; -import { env } from 'node:process'; -import { fileURLToPath } from 'node:url'; -import finalhandler from 'finalhandler'; -import serveStatic from 'serve-static'; +import { createServer } from 'node:http' +import { dirname, join } from 'node:path' +import { env } from 'node:process' +import { fileURLToPath } from 'node:url' +import finalhandler from 'finalhandler' +import serveStatic from 'serve-static' -const isCFEnvironment = env.VCAP_APPLICATION !== undefined, - PORT = isCFEnvironment ? parseInt(env.PORT) : 3030, - uiPath = join(dirname(fileURLToPath(import.meta.url)), './dist'); +const isCFEnvironment = env.VCAP_APPLICATION != null +const PORT = isCFEnvironment ? parseInt(env.PORT) : 3030 +const uiPath = join(dirname(fileURLToPath(import.meta.url)), './dist') -const serve = serveStatic(uiPath); +const serve = serveStatic(uiPath) const server = createServer(function onRequest(req, res) { - serve(req, res, finalhandler(req, res)); -}); + serve(req, res, finalhandler(req, res)) +}) -server.listen(PORT, () => console.info(`App running at: http://localhost:${PORT}`)); +server.listen(PORT, () => console.info(`App running at: http://localhost:${PORT}`))