KNEX is a wonderful ORM library that can be used with Javascript. Recently I had a chance to use it in one of my projects. Thought of sharing with all others.
In order to use Knex we need to have node package installed 'knex'. Once the package is installed we can use the following code to connect to mysql through Node with Knex.
This is a very simple way to connect our node program to mysql through Knex.
In order to use Knex we need to have node package installed 'knex'. Once the package is installed we can use the following code to connect to mysql through Node with Knex.
var knex = require('knex')({
client: 'mysql',
connection: {
host : '127.0.0.1',
user : 'root',
password : '',
database : 'test'
}
});
This is a very simple way to connect our node program to mysql through Knex.
Comments