如何在expressjs上不侦听端口3000?
我尝试使用app.listen(5050),但运行后,它将在5050和3000端口上进行侦听。如何使其仅在特定端口上侦听 这是如何在expressjs上不侦听端口3000?,express,port,listen,Express,Port,Listen,我尝试使用app.listen(5050),但运行后,它将在5050和3000端口上进行侦听。如何使其仅在特定端口上侦听 这是lsof 我不知道最后的hbci和mmcc是什么意思 实际上,我运行的代码来自gundb上的示例 const express = require('express'); const path = require('path') const Gun = require('gun'); const port = process.env.OPENSHIFT_NODEJS_PO
lsof
我不知道最后的hbci
和mmcc
是什么意思
实际上,我运行的代码来自gundb上的示例
const express = require('express');
const path = require('path')
const Gun = require('gun');
const port = process.env.OPENSHIFT_NODEJS_PORT ||
process.env.VCAP_APP_PORT ||
process.env.PORT ||
process.argv[2] ||
8080;
var app = express();
app.use(Gun.serve);
app.use(express.static(path.join(__dirname, 'public')));
// const server = app.listen(port);
const server = app.listen(5050);
Gun({
localStore: false,
web: server
});
console.log('Server started on port ' + port + ' with /gun');
module.exports = app;
在package.json的开始脚本上使用
node app.js
而不是node./bin/www
修复了它
可能是/bin/wwww
上的这行代码导致了它
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
但我现在不想碰它