I am just getting to grips with node and trying to use module.exports.
console.log(aolCount); outputs the correct value, but nothing is returned from the command return aolCount;
Here is my code.
app.js
const express = require('express');
const aol = require('./queries/aol');
const app = express();
const port = process.env.PORT || 3000
app.get('/sample', function (req, res, next) {
   res.send(aol.getAOLDataCount());
});
app.listen(port);
console.log(`Server listening on port ${port}`);
aol.js
const Sequelize = require('sequelize');
const sequelize = new Sequelize('testdb', 'root', null, {
    host: 'localhost',
    dialect: 'mysql',
    pool:{
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
    },
    define: {
        timestamps: false
    }
});
let WeeklyData = require('../../models/weekly_data');
sequelize
    .authenticate()
    .then(() => {
        console.log('Connection has been established to the Database');
    })
    .catch(err => {
        console.error('Unable to connect to the Database', err);
    });
module.exports = {
    getAOLDataCount:  function () {
        wd = new WeeklyData(sequelize, Sequelize.DataTypes);
        wd.count({where: {week:201740, project: 8}}).then(function (aolCount) {
            console.log(aolCount);
            return aolCount;
        });
    }
};
 
    