(opt)
| 27 | const API_CACHE = {} |
| 28 | |
| 29 | const api = (opt) => { |
| 30 | const resource = opt.resource_name || opt.name |
| 31 | if(API_CACHE[resource] == undefined) { |
| 32 | const API = config('api') |
| 33 | if (API) { |
| 34 | API_CACHE[resource] = new API(opt) |
| 35 | } else { |
| 36 | throw 'App API not implement!!!' |
| 37 | } |
| 38 | } |
| 39 | return API_CACHE[resource] |
| 40 | } |
| 41 | |
| 42 | export default app |
| 43 | export { |
no test coverage detected