X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=ui%2Fweb%2Fstart.js;h=39cdf0f446d338a700f2f22763ff2193b3d2187f;hb=9d7b5fa3591b5cbdfbfb44d7c2721b2050399664;hp=9b18156cffee67d340d172bfac4753c40fd9f3a6;hpb=1068742241b5ac538aa456555bfb84d25d7099f9;p=e-mobility-charging-stations-simulator.git diff --git a/ui/web/start.js b/ui/web/start.js index 9b18156c..39cdf0f4 100644 --- a/ui/web/start.js +++ b/ui/web/start.js @@ -1,16 +1,17 @@ -const http = require('node:http'), - path = require('node:path'), - { env } = require('node:process'), - finalhandler = require('finalhandler'), - serveStatic = require('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 = path.join(__dirname, './dist'); + uiPath = join(dirname(fileURLToPath(import.meta.url)), './dist'); const serve = serveStatic(uiPath); -const server = http.createServer(function onRequest(req, res) { +const server = createServer(function onRequest(req, res) { serve(req, res, finalhandler(req, res)); });