mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-28 10:14:13 +00:00
feature(express) add static
This commit is contained in:
parent
dfe097e87a
commit
8894bca353
2 changed files with 25 additions and 28 deletions
|
|
@ -118,36 +118,36 @@
|
|||
}
|
||||
|
||||
function createServer(port, ip, protocol, ssl, callback) {
|
||||
var server, app,
|
||||
var server, app, respondApp,
|
||||
isMinify = function() {
|
||||
var isMinify = main.config.minify;
|
||||
|
||||
return isMinify;
|
||||
},
|
||||
funcs = [
|
||||
Rest,
|
||||
Route,
|
||||
join({
|
||||
minify: function() {
|
||||
var isMinify = main.config.minify;
|
||||
|
||||
return isMinify;
|
||||
}
|
||||
minify: isMinify
|
||||
}),
|
||||
|
||||
minify({
|
||||
dir : DIR,
|
||||
log : true,
|
||||
is : function() {
|
||||
var isMinify = main.config.minify;
|
||||
|
||||
return isMinify;
|
||||
}
|
||||
}),
|
||||
|
||||
controller.middle(DIR)
|
||||
],
|
||||
is : isMinify
|
||||
})
|
||||
];
|
||||
|
||||
respondApp = Util.exec.with(respond, funcs);
|
||||
|
||||
expressApp = express.getApp(funcs);
|
||||
|
||||
app = expressApp || respondApp;
|
||||
if (expressApp) {
|
||||
app = expressApp;
|
||||
} else {
|
||||
funcs.push(controller.middle(DIR));
|
||||
|
||||
respondApp = Util.exec.with(respond, funcs);
|
||||
app = respondApp;
|
||||
}
|
||||
|
||||
if (ssl)
|
||||
server = https.createServer(ssl, app);
|
||||
|
|
|
|||
|
|
@ -1,20 +1,15 @@
|
|||
(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,
|
||||
var DIR = __dirname + '/../../',
|
||||
|
||||
crypto = require('crypto'),
|
||||
main = global.cloudcmd.main,
|
||||
express = main.require('express'),
|
||||
httpAuth = main.require('http-auth'),
|
||||
logger = main.require('morgan'),
|
||||
Util = main.util,
|
||||
crypto = require('crypto'),
|
||||
|
||||
basic,
|
||||
oldPass,
|
||||
oldName,
|
||||
|
|
@ -38,6 +33,8 @@
|
|||
middleware.forEach(function(middle) {
|
||||
app.use(middle);
|
||||
});
|
||||
|
||||
app.use(express.static(DIR));
|
||||
}
|
||||
|
||||
return app;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue