Comparing version 3.0.0-beta1 to 3.0.0-beta2
@@ -94,3 +94,3 @@ const path = require('path'); | ||
assert(helper.isFunction(createServerFn), 'config.createServer must be a function'); | ||
think.app.server = createServerFn(port, host, callback) | ||
think.app.server = createServerFn(think.app, port, host, callback) | ||
}else{ | ||
@@ -97,0 +97,0 @@ think.app.server = think.app.listen(port, host, callback); |
@@ -56,3 +56,3 @@ const helper = require('think-helper'); | ||
get isCli(){ | ||
return this.isMethod('cli'); | ||
return think.isCli; | ||
}, | ||
@@ -115,17 +115,12 @@ /** | ||
}else{ | ||
// if(/^[A-Z\_]+$/.test(errno)){ | ||
// let msg = this.locale(errno); | ||
// if(think.isArray(msg)){ | ||
// errno = msg[0]; | ||
// errmsg = msg[1]; | ||
// } | ||
// } | ||
if(/^[A-Z\_]+$/.test(errno)){ | ||
const messages = think.app.validators.messages || {}; | ||
const msg = messages[errno]; | ||
if(think.isArray(msg)){ | ||
[errno, errmsg] = msg; | ||
} | ||
} | ||
if (!think.isNumber(errno)) { | ||
data = errmsg; | ||
errmsg = errno; | ||
errno = this.config('defaultErrno'); | ||
[data, errmsg, errno] = [errmsg, errno, this.config('defaultErrno')] | ||
} | ||
// if(!errmsg){ | ||
// errmsg = this.locale(errno) || ''; | ||
// } | ||
obj = { | ||
@@ -198,3 +193,3 @@ [this.config('errnoField')]: errno, | ||
if(!this[POST]){ | ||
this[POST] = this.request.body && this.request.body.post || {}; | ||
this[POST] = Object.assign({}, this.request.body && this.request.body.post); | ||
} | ||
@@ -227,3 +222,3 @@ if(!name) return this[POST]; | ||
if(!this[FILE]){ | ||
this[FILE] = this.request.body && this.request.body.file || {}; | ||
this[FILE] = Object.assign({}, this.request.body && this.request.body.file); | ||
} | ||
@@ -230,0 +225,0 @@ if(!name) return this[FILE]; |
@@ -22,2 +22,38 @@ const helper = require('think-helper'); | ||
/** | ||
* get client ip | ||
*/ | ||
get ip(){ | ||
return this.ctx.ip; | ||
}, | ||
/** | ||
* get client ips | ||
*/ | ||
get ips(){ | ||
return this.ctx.ips; | ||
}, | ||
/** | ||
* get status code | ||
*/ | ||
get status(){ | ||
return this.ctx.status; | ||
}, | ||
/** | ||
* set status code | ||
*/ | ||
set status(status){ | ||
this.ctx.status = status; | ||
}, | ||
/** | ||
* get content type | ||
*/ | ||
get type(){ | ||
return this.ctx.type; | ||
}, | ||
/** | ||
* set content type | ||
*/ | ||
set type(contentType){ | ||
this.ctx.type = contentType; | ||
}, | ||
/** | ||
* get or set config | ||
@@ -60,3 +96,3 @@ * @param {String} name | ||
get isCli(){ | ||
return this.ctx.isCli; | ||
return think.isCli; | ||
}, | ||
@@ -109,3 +145,3 @@ /** | ||
/** | ||
* | ||
* get query data | ||
* @param {String} name | ||
@@ -115,3 +151,2 @@ * @param {Mixed} value | ||
get(name, value){ | ||
deprecate('controller.get is deprecate, please use controller.query instead. it will removed in ThinkJS 3.1'); | ||
return this.ctx.param(name, value); | ||
@@ -118,0 +153,0 @@ }, |
@@ -89,3 +89,3 @@ const getConfigFn = require('think-config').getConfigFn; | ||
this.initPath(); | ||
think.loader = new Loader(think.APP_PATH, thinkPath, think.app); | ||
think.loader = new Loader(think.APP_PATH, thinkPath); | ||
think.config = getConfigFn(think.loader.loadConfig(think.app.env), think.loader.modules.length > 0); | ||
@@ -106,2 +106,2 @@ think.logger = new Logger(helper.parseAdapterConfig(think.config('logger')), true); | ||
module.exports = thinkLoader; | ||
module.exports = thinkLoader; |
{ | ||
"name": "thinkjs", | ||
"description": "ThinkJS - Use full ES6/7 features to develop web applications, Support TypeScript", | ||
"version": "3.0.0-beta1", | ||
"version": "3.0.0-beta2", | ||
"author": { | ||
@@ -13,3 +13,3 @@ "name": "welefen", | ||
"scripts": { | ||
"test": "eslint lib/ && nyc ava test/", | ||
"test": "eslint lib/ && nyc ava test/case", | ||
"coverage": "nyc report --reporter=html" | ||
@@ -70,2 +70,4 @@ }, | ||
"eslint": "2.8.0", | ||
"mkdirp": "^0.5.1", | ||
"mock-require": "^2.0.1", | ||
"nyc": "^7.0.0" | ||
@@ -72,0 +74,0 @@ }, |
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
30373
1034
7