I have the following code and I'm basically making a request to my api to retrieve JSON data and exporting this custom module.
The problem is that with var data = require('./lib/data.js'); alone, data doesn't really have the data I expected to have.
If it was a physical JSON file sitting in the project, I could do var data = require('./data.json'); but I don't work with this kind of static data.
What's wrong here?
data.js (my custom module to get JSON data)
module.exports = function() {
    var request = require("request")
    var url = "http://sheetsu.com/apis/94dc0db4"
    request({
        url: url,
        json: true
    }, function (error, response, body) {
        if (!error && response.statusCode === 200) {
            console.log(body)
        }
    })
}
index.js
var express = require('express');
var router = express.Router();
var data = require('./lib/data.js');
router.get('/', function(req, res, next) {
  res.render('index', { 
    title: 'Express' 
    data: data
  });
});
module.exports = router;
 
     
    