1 const path
= require('path'),
2 finalhandler
= require('finalhandler'),
3 http
= require('http'),
4 serveStatic
= require('serve-static');
6 const isCFEnvironment
= process
.env
.VCAP_APPLICATION
!== undefined,
7 PORT
= isCFEnvironment
? parseInt(process
.env
.PORT
) : 3030,
8 uiPath
= path
.join(__dirname
, './dist');
10 const serve
= serveStatic(uiPath
);
12 const server
= http
.createServer(function onRequest(req
, res
) {
13 serve(req
, res
, finalhandler(req
, res
));
16 server
.listen(PORT
, () => console
.info(`App running at: http://localhost:${PORT}`));