zeanium-node
Advanced tools
Comparing version 0.7.1 to 0.8.0
{ | ||
"name": "zeanium-node", | ||
"version": "0.7.1", | ||
"version": "0.8.0", | ||
"description": "Zeanium for Node.js, simple http server and custome your business.", | ||
@@ -33,5 +33,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"chokidar": "^1.7.0", | ||
"formidable": "^1.1.1", | ||
"mysql": "^2.13.0", | ||
"chokidar": "^2.1.2", | ||
"formidable": "^1.2.1", | ||
"mysql": "^2.16.0", | ||
"zeanium": "^1.1.29" | ||
@@ -38,0 +38,0 @@ }, |
@@ -7,2 +7,3 @@ /** | ||
'./HttpServerContext', | ||
'node:os', | ||
'node:http', | ||
@@ -14,2 +15,3 @@ 'node:https', | ||
HttpServerContext, | ||
node_os, | ||
node_http, | ||
@@ -35,3 +37,3 @@ node_https, | ||
this.__initNodePaths(_config); | ||
this.__createHttpServer(_config); | ||
this.__initConfig(_config); | ||
this.__createHttpServerContext(_config); | ||
@@ -62,3 +64,40 @@ }, | ||
}, | ||
__createHttpServer: function (config){ | ||
__createClusterServer: function (config){ | ||
if(node_cluster.isMaster){ | ||
zn.info("主进程 "+ process.pid + " 正在运行中..."); | ||
var _cpus = node_os.cpus().length; | ||
for(var i = 0; i < _cpus; i++){ | ||
node_cluster.fork(); | ||
} | ||
node_cluster.on('exit', function (worker, code, signal){ | ||
zn.error("工作进程 "+worker.process.pid + " 已退出"); | ||
}) | ||
}else{ | ||
zn.info("服务启动..."); | ||
this.__createHttpServer2(config); | ||
} | ||
}, | ||
__initConfig: function (config){ | ||
var _port = config.port; | ||
if(zn.is(_port, 'number')){ | ||
if(config.clusters){ | ||
var _min = _port, | ||
_count = zn.is(config.clusters, 'number')?config.clusters:node_os.cpus().length, | ||
_max = _min + _count; | ||
_port = [_min]; | ||
while(_min<_max-1){ | ||
_min++; | ||
_port.push(_min); | ||
} | ||
}else{ | ||
_port = [_port]; | ||
} | ||
} | ||
if(zn.is(_port, 'array')){ | ||
config.port = _port; | ||
return _port.forEach((port)=>this.__createHttpServer(config, port)); | ||
} | ||
}, | ||
__createHttpServer: function (config, port){ | ||
var _server = null; | ||
@@ -73,3 +112,3 @@ if(config.https){ | ||
_server.addListener("close", this.__onClose.bind(this)); | ||
_server.listen(config.port, config.host); | ||
_server.listen(port||config.port, config.host); | ||
return _server; | ||
@@ -76,0 +115,0 @@ }, |
@@ -0,1 +1,7 @@ | ||
/*Add current path to NODE_PATH*/ | ||
var path = require('path'); | ||
var _curr = process.cwd() + path.sep + 'node_modules'; | ||
var _parents = module.constructor._nodeModulePaths(_curr); | ||
process.env.NODE_PATH = process.env.NODE_PATH + path.delimiter + _parents.join(path.delimiter); | ||
module.constructor._initPaths(); | ||
module.exports = require('zeanium'), zn.ZN_PATH = __dirname; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
273649
6345
8
+ Addedanymatch@2.0.0(transitive)
+ Addedchokidar@2.1.8(transitive)
+ Addedglob-parent@3.1.0(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@3.1.04.0.3(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedpath-dirname@1.0.2(transitive)
+ Addedupath@1.2.0(transitive)
- Removedanymatch@1.3.2(transitive)
- Removedarr-diff@2.0.0(transitive)
- Removedarray-unique@0.2.1(transitive)
- Removedbraces@1.8.5(transitive)
- Removedchokidar@1.7.0(transitive)
- Removedexpand-brackets@0.1.5(transitive)
- Removedexpand-range@1.8.2(transitive)
- Removedextglob@0.3.2(transitive)
- Removedfilename-regex@2.0.1(transitive)
- Removedfill-range@2.2.4(transitive)
- Removedfor-own@0.1.5(transitive)
- Removedglob-base@0.3.0(transitive)
- Removedglob-parent@2.0.0(transitive)
- Removedis-dotfile@1.0.3(transitive)
- Removedis-equal-shallow@0.1.3(transitive)
- Removedis-extglob@1.0.0(transitive)
- Removedis-glob@2.0.1(transitive)
- Removedis-number@2.1.04.0.0(transitive)
- Removedis-posix-bracket@0.1.1(transitive)
- Removedis-primitive@2.0.0(transitive)
- Removedmath-random@1.0.4(transitive)
- Removedmicromatch@2.3.11(transitive)
- Removedobject.omit@2.0.1(transitive)
- Removedparse-glob@3.0.4(transitive)
- Removedpreserve@0.2.0(transitive)
- Removedrandomatic@3.1.1(transitive)
- Removedregex-cache@0.4.4(transitive)
Updatedchokidar@^2.1.2
Updatedformidable@^1.2.1
Updatedmysql@^2.16.0