Using #es6 classes for Sequelize 4 models
▻https://hackernoon.com/using-es6-classes-for-sequelize-4-models-b9fd54a5f8c9?source=rss----3a81
Photo by Eugene Lim on UnsplashThe ES2015 or ES6 specification introduced class to #javascript. Libraries like React went from React.createClass to class MyComponent extends React.Component, ie went from rolling their own constructor to leveraging a language built-in to convey the programmer’s intent.For a Node.js web application’s persistence layer, a few databases come to mind like MongoDB (possibly paired with mongoose), or a key-value store like Redis.To run a relational database with a Node application, Sequelize, “An easy-to-use multi SQL dialect ORM for Node.js” is a good option. It allows the application to run backed by a MySQL or PostgreSQL instance and provides an easy way to map from entities’ representation in the database to JavaScript and vice versa.Sequelize’s API for model (...)