Differentiate between http server and express app

This commit is contained in:
Marcel Klehr 2012-09-21 17:12:22 +02:00
parent c8b6d3b4f3
commit 4416210471
3 changed files with 11 additions and 8 deletions

View file

@ -1,4 +1,5 @@
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
var http = require('http');
var express = require('express');
var settings = require('../utils/Settings');
var fs = require('fs');
@ -48,17 +49,18 @@ exports.restartServer = function () {
server.close();
}
server = express(); // New syntax for express v3
var app = express(); // New syntax for express v3
server = http.createServer(app);
server.use(function (req, res, next) {
app.use(function (req, res, next) {
res.header("Server", serverName);
next();
});
server.configure(function() {
hooks.callAll("expressConfigure", {"app": server});
app.configure(function() {
hooks.callAll("expressConfigure", {"app": app});
});
hooks.callAll("expressCreateServer", {"app": server});
hooks.callAll("expressCreateServer", {"app": app, "server": server});
server.listen(settings.port, settings.ip);
}