Skip to main content

Posts

Showing posts from July, 2019

create simple sequelize model

A few days ago, I started trying to figure out Sequelize, a promise-based ORM for NodeJS. I have always been a fan of JavaScript; it was the first programming language I started studying when I was only 15, along with — surprise, surprise — HTML5 and CSS3. Suffice to say, I wanted to try and find the best ORM solution for NodeJS. After all, C# has Entity Framework and Java has Hibernate, so it was ripe time to find one for Node as well. I made my first search and found  Sequelize  to have around 250,000 downloads per week on npm. Not bad… I started reading the documentation with its  Getting Started  section. It looked easy and fun, the code flowing out of me like a rivulet in spring, but then I arrived at a point where all my attempts just snagged on a barb in the documentation. I couldn’t for the life of me create a foreign key constraint Sequelize  is a promise-based ORM for Node.js. Sequelize is easy to learn and has dozens of cool features like sync...