Search code examples
node.jsbookshelf.jsknex.js

bookshelf without knex - execute query


I have a functioning node.js application with logs data to a mysql database. (without using knex.js)

Now, I want to add functionality to query into my database tables. My question is do I now need knex.js? Is it possible to execute queries without knex?

I could not clearly find examples of this.


Solution

  • From the main Bookshelf page:

    Bookshelf is a JavaScript ORM for Node.js, built on the Knex SQL query builder. Featuring both promise based and traditional callback interfaces, it follows the Model & Collection patterns seen in Backbone.js, providing transaction support, eager/nested-eager relation loading, polymorphic associations, and support for one-to-one, one-to-many, and many-to-many relations.

    Bookshelf requires a knex connection to operate. You cannot (nor should you) use Bookshelf without Knex.