переход на expres 3.x.x

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/nodeJSProjects@50503 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
Alexey.Golubev
2013-10-07 09:57:16 +00:00
committed by Alexander.Trofimov
parent 4902c1ebf1
commit 5e8d6734a6
2 changed files with 17 additions and 8 deletions

View File

@ -9,7 +9,7 @@ ECHO ----------------------------------------
ECHO Install node.js modules
ECHO ----------------------------------------
call npm install express@2.5.8 || exit /b 1
call npm install express || exit /b 1
call npm install underscore || exit /b 1
call npm install sockjs || exit /b 1
call npm install mongodb@1.1.4 || exit /b 1

View File

@ -6,18 +6,27 @@ var logger = require('./../../Common/sources/logger');
// 2. Express server
var express = require('express');
var app = {};
var http = require('http');
var https = require('https');
var fs = require("fs");
var app = express();
var server = {};
if(config['ssl'])
{
var fs = require("fs");
var privateKey = fs.readFileSync(config['ssl']['key']).toString();
var certificate = fs.readFileSync(config['ssl']['cert']).toString();
app = express.createServer({key: privateKey, cert:certificate});
var options = {key: privateKey, cert:certificate};
server = https.createServer(options, app);
}
else
{
app = express.createServer();
server = http.createServer(app);
}
app.configure(function(){
@ -36,9 +45,9 @@ app.configure('production', function(){
var docsCoServer = require('./DocsCoServer');
docsCoServer.install(app, function(){
app.listen(config['server']['port'], function(){
logger.info("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
docsCoServer.install(server, function(){
server.listen(config['server']['port'], function(){
logger.info("Express server listening on port %d in %s mode", config['server']['port'], app.settings.env);
});
app.get('/index.html', function(req, res) {