Comparing version 0.1.5 to 0.1.6
@@ -24,3 +24,2 @@ import Service from './service.js' | ||
} | ||
this.children = config.children || {} | ||
if (config.services) { | ||
@@ -67,7 +66,11 @@ forEach(config.services, (service, name) => | ||
forEach(path, item => { | ||
if (!service.children || !(name in service.children)) { | ||
if (!service.config.children) { | ||
throw `No children detected on ${item} of ${path}` | ||
} | ||
if (!(item in service.config.children)) { | ||
throw `Service ${name} not found` | ||
} | ||
service = service.children[item] | ||
service = service.config.children[item] | ||
}) | ||
console.log(service) | ||
try { | ||
@@ -74,0 +77,0 @@ if (!service) throw `Service ${name} not found` |
{ | ||
"name": "apicase", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Create, group and manage your APIs with json declaration", | ||
@@ -23,4 +23,5 @@ "author": "kelin2025", | ||
"lodash.set": "^4.3.2", | ||
"lodash.values": "^4.3.0" | ||
"lodash.values": "^4.3.0", | ||
"path-to-regexp": "1.7.0" | ||
} | ||
} |
@@ -28,2 +28,3 @@ import pick from 'lodash/pick' | ||
this.config.hooks = config.hooks || {} | ||
this.config.children = mapValues(this.config.children || {}, child => new Service(child, container)) | ||
if (config.url) { | ||
@@ -77,3 +78,3 @@ Object.defineProperties(this, { | ||
} else { | ||
let url = Utils.getUrl(ctx, ctx.query)(ctx.params.params || {}) | ||
let url = Utils.getUrl(ctx, ctx.query)(params.params || {}) | ||
let options = { | ||
@@ -80,0 +81,0 @@ method: ctx.config.method || 'GET', |
@@ -22,6 +22,3 @@ import has from 'lodash/has' | ||
} | ||
return { | ||
get: mixin.get, | ||
set: mixin.set || null | ||
} | ||
return pick(mixin, ['get', 'set']) | ||
} | ||
@@ -28,0 +25,0 @@ |
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
10267
320
18
+ Addedpath-to-regexp@1.7.0
+ Addedisarray@0.0.1(transitive)
+ Addedpath-to-regexp@1.7.0(transitive)