npm install knex@0.6 --save
npm install mysql
var knex = require('knex')({
client: 'mysql',
connection: {
host : '127.0.0.1',
答雹 user 清吵帆 : 'your_database_user',
password : 'your_database_password',
database : 'myapp_test'
}
});knex.select('title', 'author', 'year').from('books').then(function(data){
//取到的数据
console.log(data)
})
更多碰散:
http://knexjs.org/