title: How to make the return values of findOrCreate available to router
body: <p>So in my express app I have a separate file database.js, which contains all the models and functions for inserting, deleting, updating etc. I also have a separate controller for each model.</p>
  
  <p>database.js</p>
  
  <pre><code>module.exports = {
      createUser: function (username, email, password) {
          return sequelize.sync().then(function () {
              User.findOrCreate({
                  where: {
                      username: name,
                      email: email
                  },
                  defaults: {
                      username: username,
                      password: password,
                      email: email
                  }
              }).then(([user, created]) =&gt; {
                  console.log(user.get({plain:true}));
                  console.log(created)
                  });
              });
          }
      };
  </code></pre>
  
  <p>controllers/user.js</p>
  
  <pre><code>const database = require("../database.js");
  module.exports = {
      register: function (req, res) {
          database.createUser(req.body.username, req.body.email, req.body.password);
          res.json({...
          })
  
      }
  };
  </code></pre>
  
  <p>So basically I wanna get the user object and the boolean that tells me if it was created to the router so I can check if the user was created and make an appropriate response.</p>