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 request = require('superagent'); | |
var yieldable = require('yieldable'); | |
var co = require('co'); | |
yieldable([ | |
request.Request | |
]); | |
co(function *() { | |
var ua = 'Mozilla/1.0'; |
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 mongo = require('mongodb'); | |
var format = require('util').format; | |
var co = require('co'); | |
const MONGO_URL = 'mongodb://127.0.0.1:27017/test'; | |
// MongoClient.connect(MONGO_URL, function(err, db) { | |
// if(err) throw err; | |
// var collection = db.collection('test_insert'); | |
// collection.insert({a:2}, function(err, docs) { |
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
// npm install mongodb thunkify-wrap co | |
var mongo = require('mongodb'); | |
var t = require('thunkify-wrap'); | |
var co = require('co'); | |
co(function*(){ | |
var db = yield t(mongo.MongoClient.connect)('mongodb://127.0.0.1:27017/test'); | |
var items = db.collection('items'); | |
// cleanup |