sábado, 5 de noviembre de 2022

What is sequelize.js?

 https://usecsv.com/community/sequelize-with-nodejs

What is sequelize.js?


Sequelize is a promise-based, Node.js ORM (Object-relational mapping) for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. It features solid transaction support, relations, eager and lazy loading, read replication, and more.

A great thing about Sequelize is that it does not care about your underlying database. You can easily switch databases by adjusting the configuration file, and your code will mostly remain the same.

svg viewer
Interaction between database and Node.js
  1. Install the relevant packages using npm or yarn.
  1. Configure your database.

You need a Sequelize instance to pass a connection URI. The authenticate() function can be used to test if the connection has been established.

Modeling your database using Sequelize is very convenient. A model in Sequelize is basically a representation of a table in your database. A Model instance contains details about the entity it represents. Every model has a name in Sequelize.

Here is a basic example of modeling the data:

No hay comentarios:

Publicar un comentario