mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
feature(express) add
This commit is contained in:
parent
8f85326cf3
commit
94b6492a66
3 changed files with 31 additions and 10 deletions
|
|
@ -27,9 +27,10 @@
|
|||
http = main.http,
|
||||
https = main.https,
|
||||
Util = main.util,
|
||||
express = main.require('express'),
|
||||
express = main.express,
|
||||
expressApp = express.getApp(controller),
|
||||
|
||||
app, Server, Rest, Route, Minimize;
|
||||
Server, Rest, Route, Minimize;
|
||||
|
||||
/* базовая инициализация */
|
||||
function init(pAppCachProcessing) {
|
||||
|
|
@ -94,13 +95,9 @@
|
|||
},
|
||||
|
||||
lHTTPServer = function() {
|
||||
if (express) {
|
||||
app = express(),
|
||||
app.use(express.logger('dev'))
|
||||
.all('*', controller);
|
||||
|
||||
Server = http.createServer(app);
|
||||
} else
|
||||
if (expressApp)
|
||||
Server = http.createServer(expressApp);
|
||||
else
|
||||
Server = http.createServer(controller);
|
||||
|
||||
Server.on('error', Util.log);
|
||||
|
|
@ -165,7 +162,7 @@
|
|||
/* added supporting of Russian language in directory names */
|
||||
lPath = Querystring.unescape(lPath);
|
||||
|
||||
if (!express)
|
||||
if (!expressApp)
|
||||
Util.log(pReq.method + ' ' + lPath + lQuery);
|
||||
|
||||
var lData = {
|
||||
|
|
|
|||
23
lib/server/express.js
Normal file
23
lib/server/express.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
if (!global.cloudcmd)
|
||||
return console.log(
|
||||
'# express.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# easy to use web server.' + '\n' +
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
express = main.require('express'),
|
||||
app = express && express();
|
||||
|
||||
exports.getApp = function(controller) {
|
||||
if (app)
|
||||
app.use(express.logger('dev'))
|
||||
.all('*', controller);
|
||||
|
||||
return app;
|
||||
};
|
||||
})();
|
||||
|
|
@ -103,6 +103,7 @@
|
|||
/* Additional Modules */
|
||||
exports.pipe = pipe = srvrequire('pipe'),
|
||||
exports.socket = srvrequire('socket'),
|
||||
exports.express = srvrequire('express'),
|
||||
exports.auth = srvrequire('auth').auth,
|
||||
exports.appcache = srvrequire('appcache'),
|
||||
exports.cloudfunc = CloudFunc = librequire('cloudfunc'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue