Commit 2fe45e02 authored by wty's avatar wty

修改服务器启动代码

parent 952061d7
......@@ -12,7 +12,7 @@ let http = require('http');
* Get port from environment and store in Express.
*/
let port = normalizePort(process.env.PORT || '3000');
let port = normalizePort(process.env.PORT || '3001');
app.set('port', port);
console.info('port',port)
......@@ -20,15 +20,15 @@ console.info('port',port)
* Create HTTP server.
*/
// let server = http.createServer(app);
let server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
// server.listen(port);
// server.on('error', onError);
// server.on('listening', onListening);
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
......@@ -81,11 +81,11 @@ function onError(error) {
/**
* Event listener for HTTP server "listening" event.
*/
//
// function onListening() {
// let addr = server.address();
// let bind = typeof addr === 'string'
// ? 'pipe ' + addr
// : 'port ' + addr.port;
// debug('Listening on ' + bind);
// }
function onListening() {
let addr = server.address();
let bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment