Skip to content

Instantly share code, notes, and snippets.

@devtdeng
Created February 23, 2015 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devtdeng/1d49652cd45f7177a09e to your computer and use it in GitHub Desktop.
Save devtdeng/1d49652cd45f7177a09e to your computer and use it in GitHub Desktop.
var data_collection;
for (var i in jsonbody.rest)
{
jsonbody.rest[i]["savedtime"] = new Date().toISOString();
data_collection.save(jsonbody.rest[i] , function(err, saved) {
if( err || !saved ) console.log("Rest not saved: " + err);
else ;
});
}
// curl http://<host>/api/crawlGnavi?area=PREF47 #PREF47=Okinawa
app.get('/api/crawlGnavi', function (req, res) {
var cursor = "cursor";
var prefecture = "" + req.query.area;
db = mongodbManager.getConnection([cursor, prefecture]);
data_collection = db.collection(prefecture);
startCrawling(req.query.area);
res.send('Started crawling pref:' + req.query.area);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment