2

数か月前、以下のコードは完全に機能し、couchdb (iriscouch) に新しいドキュメントを追加するために使用されました。

現在、HTTP ステータス 500 を取得しています。回避策はありますか?

コード (Node.js 内):

var http=require('http');

var options = {
  host: 'sbose78.iriscouch.com',
  path: '/bosedb1',
  method: 'POST',

  headers:{
 'Content-Type':'application/json',
 'accept':'application/json'
   }
 };

var data={
   'servings' : 4,
   'subtitle' : "Delicious with fresh bread",
   'title' : "Fish Stew------"
};

var req = http.request(options, function(res) {
   console.log('STATUS: ' + res.statusCode);
   console.log('HEADERS: ' + JSON.stringify(res.headers));
     var body="";

   res.on('data', function (chunk) {
     body+=chunk;
         console.log('BODY(inside listener):\n ' + body);

   }); 

  console.log('BODY (outside listener): ' + body);

});


req.on('error', function(e) {
  console.log('problem with request: ' + e.message);
});



 //write data to request body
req.write(JSON.stringify(data));
req.end();

応答:

    STATUS: 500
HEADERS: {"content-type":"text/plain","content-length":"239"}
BODY(inside listener):
 Internal routing error

Sorry, we cannot connect to the intended server.

We have just been notified of this problem. We will correct it as soon as possible.

Feel free to contact us if you have any questions: support@iriscouch.com
4

2 に答える 2

2

現在http://www.iriscouch.com/がダウンしているようです。

Host not found: www.iriscouch.com
于 2012-04-18T11:41:26.433 に答える
2

少なくとも http を行うために、抽象化レイヤーの使用を検討しましたか?

そうしないと、コードベースに多くの http コードが含まれることになります :)

個人的には、リクエストに基づいて node.js CouchDB クライアントを作成および保守しています。興味がある場合は、githubで詳細を確認できます。

于 2012-04-18T12:20:28.550 に答える