在expressjs 3中,我可以做到
var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
var domain = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
http.createServer(app).listen(port, domain);
在express4中
var server = app.listen(app.get(port), function()
如何在expressjs4中添加域
答案 0 :(得分:1)
Express 4几乎遵循同样的事情:
var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
var domain = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
var express = require('express');
var app = express();
app.listen(port, domain);