Cloudant にログ ファイル (テキスト形式) をロードしました。ファイルの解析に使用できる node.js コードがあるかどうか、または独自のパーサーを作成する必要があるかどうかがわかりません。
3 に答える
2
これは、Bluemix の node.js アプリケーションから Cloudant のドキュメントにアクセスする方法に関する優れたチュートリアルです。
require('http').createServer(function(req, res) {
//Set up the DB connection
if (process.env.VCAP_SERVICES) {
// Running on Bluemix. Parse for the port and host that we've been assigned.
var env = JSON.parse(process.env.VCAP_SERVICES);
var host = process.env.VCAP_APP_HOST;
var port = process.env.VCAP_APP_PORT;
....
}
....
// Perform CRUD operations through REST APIs
// Insert document
if(req.method == 'POST') {
insert_records(req,res);
}
// List documents
else if(req.method == 'GET') {
list_records(req,res);
}
// Update a document
else if(req.method == 'PUT') {
update_records(req,res);
}
// Delete a document
else if(req.method == 'DELETE') {
delete_record(req,res);
}
}).listen(port, host);
于 2015-04-17T21:03:14.523 に答える
0
参考にするには、もう少し情報が必要だと思います。いくつか質問があります。
- ログのテキストはどのような形式ですか? たとえば、JSON? XML? 他の何か?
- そもそもどのようにテキストを Cloudant に追加したのですか? Cloudant と対話するために特定のモジュールを使用していますか? (たとえば、Cloudant Node.js Clientを使用します。)
于 2014-11-15T23:01:28.653 に答える