Ulises Vargas De Sousa Ulises Vargas De Sousa - 2 months ago 31
Node.js Question

Node.js: How to use a Postgres Stored Procedure in Sequelize?

I'm recently learning all specs of this powerful ORM, like migrating tables, define schemas, define models, associations, inserts, etc.

My particular question is How manage Postgres Stored Procedures (SP) in sequelize?

I'm using Node.js for my server.

rsp rsp
Answer

You can use:

sequelize.query('CALL yourStoredProcedure();').then(data => {
    // success ...
  }).catch(error => {
    // error ...
  });