Created
July 29, 2015 05:55
-
-
Save mikebobadilla/f07b1dc19f6326b8b064 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 Promise = require('bluebird'); | |
var knex = require('knex')({ | |
client: 'mysql', | |
connection: { | |
host: '127.0.0.1', | |
user: 'root', | |
password: '', | |
database: 'steam', | |
charset: 'utf8' | |
} | |
}); | |
var bookshelf = require('bookshelf')(knex); | |
var User = bookshelf.Model.extend({ | |
tableName: 'users' | |
}); | |
var Users = bookshelf.Collection.extend({ | |
model: User | |
}); | |
setTimeout(function(){ | |
Users.forge() | |
.fetch() | |
.then(function (collection) { | |
console.log(collection.models[0].attributes); | |
}) | |
.catch(function (err) { | |
console.log(err); | |
}); | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment