Commit | Line | Data |
---|---|---|
10687422 JB |
1 | const 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 |
7 | const isCFEnvironment = env.VCAP_APPLICATION !== undefined, |
8 | PORT = isCFEnvironment ? parseInt(env.PORT) : 3030, | |
efdd1922 | 9 | uiPath = path.join(__dirname, './dist'); |
32de5a57 LM |
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 | ||
efdd1922 | 17 | server.listen(PORT, () => console.info(`App running at: http://localhost:${PORT}`)); |