2016-05-05 3 views
1

私は、ループバックのドキュメントからいくつかのチュートリアルを続けてきました。 - 私は現在、このチュートリアルに従うことによって、APIエクスプローラを実行しようとしている:ループバックAPIエクスプローラの使用

https://docs.strongloop.com/display/public/LB/Use+API+Explorer

私はCoffeShopモデルを作成しました。そして、POST要求を作成する手順に従いました。しかし、私は次の404エラーが発生しています。

{ 
    "error": { 
    "name": "Error", 
    "status": 404, 
    "message": "There is no method to handle POST /Coffe%20Shops", 
    "statusCode": 404, 
    "stack": "Error: There is no method to handle POST /Coffe%20Shops\n at restUrlNotFound (..\\hello\\node_modules\\strong-remoting\\lib\\rest-adapter.js:339:17)\n at Layer.handle [as handle_request] (..\\hello\\node_modules\\express\\lib\\router\\layer.js:95:5)\n at trim_prefix (..\\hello\\node_modules\\express\\lib\\router\\index.js:312:13)\n at ..\\hello\\node_modules\\express\\lib\\router\\index.js:280:7\n at Function.process_params (..\\hello\\node_modules\\express\\lib\\router\\index.js:330:12)\n at next (..\\hello\\node_modules\\express\\lib\\router\\index.js:271:10)\n at ..\\hello\\node_modules\\body-parser\\lib\\read.js:129:5\n at invokeCallback (..\\hello\\node_modules\\raw-body\\index.js:262:16)\n at done (..\\hello\\node_modules\\raw-body\\index.js:251:7)\n at IncomingMessage.onEnd (..\\hello\\node_modules\\raw-body\\index.js:308:7)" 
    } 
} 

私はチュートリアルからgit repoをクローンしていて、正常に動作しています。私はすべてのステップを踏んだが、このエラーを引き起こす原因は何か分からない。

誰でもお手伝いできますか?

+0

これは、プロジェクトを見ずにデバッグが困難ですが、あなたは間違いなくどこかにあなたのプロジェクトのconfig問題を抱えています。あなたが持っているものをgithubリポジトリにアップロードしてリンクを投稿できますか? – amuramoto

答えて

1

"CoffeeShop"のスペルが間違っている可能性があります。 "%20"は、ループバックを捨てている名前にスペースを入れたことを示しています。

私はここに方向に続く:

$ git clone https://github.com/strongloop/loopback-getting-started.git 
$ cd loopback-getting-started 
$ git checkout step1 
$ npm install 

をし、問題なくPOSTリクエストを取得することができました。

enter image description here

私は、モデルを持続し、そのテンプレートにGitのクローンを行うことなく、再びそれを試してみましたが、何の問題もなかった私自身のカスタムコーヒーショップを作成しました:

coffee-shop.json

{ 
    "name": "CoffeeShop", 
    "base": "PersistedModel", 
    "idInjection": true, 
    "options": { 
     "validateUpsert": true 
    }, 
    "properties": { 
     "name": { 
      "type": "string", 
      "required": true 
     }, 
     "city": { 
      "type": "string", 
      "required": true 
     } 
    }, 
    "validations": [], 
    "relations": {}, 
    "acls": [], 
    "methods": {} 
} 

私のアドバイスはなりチュートリアルでカスタムソリューションと提供されたソリューションを比較することも、新しいプロジェクトをすぐに再試行することもできます。

前述のように、コードなしでは、正確な問題を再現するのは難しいですが、構文エラーのように見えます。

バージョン:

npm 2.14.4 
node 4.1.2 
strongloop 6.0.0 
+0

うわー...確かに問題はスペースだった...私はそんなに馬鹿だと感じる。どうもありがとうございました! –

関連する問題