mirror of https://gitee.com/pnoker/dc3-web.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
706 B
47 lines
706 B
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Module dependencies.
|
|
*/
|
|
|
|
const app = require('../app');
|
|
const http = require('http');
|
|
|
|
/**
|
|
* Get port from environment and store in Express.
|
|
*/
|
|
|
|
const port = normalizePort(process.env.PORT || '3000');
|
|
app.set('port', port);
|
|
|
|
/**
|
|
* Create HTTP server.
|
|
*/
|
|
|
|
const server = http.createServer(app);
|
|
|
|
/**
|
|
* Listen on provided port, on all network interfaces.
|
|
*/
|
|
|
|
server.listen(port);
|
|
|
|
/**
|
|
* 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;
|
|
} |