2016-05-17 7 views
1

ループバックをセットアップしようとしていますが、これまでのところ、モデルをmysqlに接続してdb接続を作成しました。しかし、私は、任意の呼び出しで、このエラーを得続ける:ここ (find、findbyid、create)メソッドが設定されていませんループバック

"The find method has not been setup loopback. The PersistedModel has not been correctly attached to a DataSource! 

が完了応答である:ここ

{ 
    "error": { 
    "name": "Error", 
    "status": 500, 
    "message": "Cannot call EaAssets.find(). The find method has not been setup. The PersistedModel has not been correctly attached to a DataSource!", 
    "stack": "Error: Cannot call EaAssets.find(). The find method has not been setup. The PersistedModel has not been correctly attached to a DataSource!\n at throwNotAttached (C:\\cmdb\\node_modules\\loopback\\lib\\persisted-model.js:62:11)\n at Function.find (C:\\cmdb\\node_modules\\loopback\\lib\\persisted-model.js:210:5)\n at SharedMethod.invoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\shared-method.js:252:25)\n at HttpContext.invoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\http-context.js:384:12)\n at phaseInvoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\remote-objects.js:645:9)\n at runHandler (C:\\cmdb\\node_modules\\loopback-phase\\lib\\phase.js:135:5)\n at iterate (C:\\cmdb\\node_modules\\async\\lib\\async.js:146:13)\n at Object.async.eachSeries (C:\\cmdb\\node_modules\\async\\lib\\async.js:162:9)\n at runHandlers (C:\\cmdb\\node_modules\\loopback-phase\\lib\\phase.js:144:13)\n at iterate (C:\\cmdb\\node_modules\\async\\lib\\async.js:146:13)" 
    } 
} 

され、私のモデル-config.json

{ 
    "_meta": { 
    "sources": [ 
     "loopback/common/models", 
     "loopback/server/models", 
     "../common/models", 
     "./models" 
    ], 
    "mixins": [ 
     "loopback/common/mixins", 
     "loopback/server/mixins", 
     "../common/mixins", 
     "./mixins" 
    ] 
    }, 
    "User": { 
    "dataSource": "db" 
    }, 
    "AccessToken": { 
    "dataSource": "db", 
    "public": false 
    }, 
    "ACL": { 
    "dataSource": "db", 
    "public": false 
    }, 
    "RoleMapping": { 
    "dataSource": "db", 
    "public": false 
    }, 
    "Role": { 
    "dataSource": "db", 
    "public": false 
    }, 
    "EaApplication": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaAssetCapabilityRelation": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaAssetTyp": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaAssetStatus": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaAssetLocation": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaAssetRelation": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaAssets": { 
    "dataSource": null, 
    "public": true, 
    "$promise": {}, 
    "$resolved": true 
    }, 
    "EaCapability": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaRelationType": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaServers": { 
    "dataSource": "db", 
    "public": true 
    }, 
    "EaServices": { 
    "dataSource": null, 
    "public": true, 
    "$promise": {}, 
    "$resolved": true 
    }, 
    "EaBuildTyp": { 
    "dataSource": "db", 
    "public": true 
    } 
} 

答えて

3

EaAssetsモデルのデータソースはnullであるため、組み込みのリモートメソッドは接続されません。

関連する問題