Calling stored procedures in Sequelize.js

Call SP with parameters in Sequelize

sequelize
  .query('CALL login (:email, :pwd, :device)', 
        {replacements: { email: "[email protected]", pwd: 'pwd', device: 'android', }})
  .then(v=>console.log(v));

sequalise queries return promises so below is how i query stored procedures.

sequelize.query('CALL calculateFees();').then(function(response){
     res.json(response);
    }).error(function(err){
       res.json(err);
});

I am sure, you may also need to get output from stored procedure. Here is a code including output value from procedure, using sequelize:

models.sequelize.query('DECLARE @outParam1 INT, @outParam2 INT EXEC procedureName @param1=:param, @outParam1 = @outParam1 output, @outParam2 = @outParam2 output SELECT @outParam1 AS "outParam1", @outParam2 AS "outParam2"',
    {
    replacements:
    {
        param: 123
        },
        type: models.sequelize.QueryTypes.EXEC
    }).spread(result => {
    if (result)
    {
        console.log("\nInside result : " + JSON.stringify(result));
        //return response here
    }

Change success to spread and you're good to go. Note that this will only work on sequlize 2.0