Effective clean way to initialize Sequelize as an object

Home \ Coding \ Effective clean way to initialize Sequelize as an object

Sequelize is an ORM for Node.js that I have decided to use in a project. I, like most of my fellow programmers, generally like cleaner code and in this case I found a pretty damn good way to initialize it and keep the initializing functions separate from rest of the code. Further, I structured it so that it was very easy to use it as well.

To use this code you would simply do something like:

This is how you use that, this is a bit complicated because it’s from an actual application:

Sami K.

Sami K. is a developer and founder of Etopian.

2 Responses to Effective clean way to initialize Sequelize as an object

  1. Nice and well explained, but there is a way to demonstrate how to connect to a database and exchange some elements with it, ’cause I’m working on a project that need a communication to DB under node.js

Leave a Reply

Name:*

Email:*

Website:

Message:*