I'm a little bit newbie with Nodejs. I'm working in a Nodejs - express solution (as webservice of an angularjs web). I want to send and e-mail when MSSSQL database query gives back some information. This is working well for me. The problem is this function should be call in the app.js (when the nodejs server starts), because the function don't should respond to any frontend/web call.

The function: 

```
exports.sendMailBuy = function(req, res) {
//do stuff
}

```

The app.js

```
var silkcartCtrl = require('./controllers/silkcart.controller');

```

I need to connect with the database, so I've tried to call the funciont in the same function db connection (I'm using Tedious):

```
dbsqlservertoken.connect().then(function(err, req, res) {
   console.log('Connection pool open for sql server');
   silkcartCtrl.sendMailBuy(req, res);
}).catch(function(err) {
  console.error('Error creating connection pool', err);
});

```

With this call I reach the function in the controller, but the `req` and `res` vars are empty, so the connection could not be done. 

Any help will be appreciate.

Thanks in advance.