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');
7 const isCFEnvironment
= env
.VCAP_APPLICATION
!== undefined,
8 PORT
= isCFEnvironment
? parseInt(env
.PORT
) : 3030,
9 uiPath
= path
.join(__dirname
, './dist');
11 const serve
= serveStatic(uiPath
);
13 const server
= http
.createServer(function onRequest(req
, res
) {
14 serve(req
, res
, finalhandler(req
, res
));
17 server
.listen(PORT
, () => console
.info(`App running at: http://localhost:${PORT}`));