Created
February 23, 2015 17:06
-
-
Save devtdeng/1d49652cd45f7177a09e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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