| Current Path : /proc/thread-self/root/proc/thread-self/root/home/deltalab/PMS/buy-button-generator/bin/ |
| Current File : //proc/thread-self/root/proc/thread-self/root/home/deltalab/PMS/buy-button-generator/bin/www |
// configure environment variables
require ('dotenv').config();
const app = require('../app');
const http = require('http');
/**
* Get port from environment and store in Express.
*/
const port = normalizePort(process.env.PORT || '3003');
app.set('port', port);
/**
* Create HTTP server.
*/
const server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', (error) => {
if (error.syscall !== 'listen') {
throw error;
}
const bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break; //pretty useless but linter wants it
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break; //pretty useless but linter wants it
default:
throw error;
}
});
server.on('listening', () => {
const addr = server.address();
// Print something so you know where the server is running
console.log(addr);
// register the current module
const indacoModulesRegistration = require('../models/indaco-modules/index');
indacoModulesRegistration.registerIndacoModuleAsync(indacoModulesRegistration.indacoModulesRegistries.BUBU);
});
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
const port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}