commonRoutes.js

const dbCollections = require('../../config/db/dbCollections');
const DownloadFile = require('../../components/files/DownloadFile');
const Http = require('../../lib/modules/Http');

function commonRoutes(app, routeOptions) {
    // List of collections available
    var DB;
    if(routeOptions.database) {
        DB = dbCollections(routeOptions.database);
    }

    function redirectToHome(res) {
        // sendfile is relative to app root directory
        if(process.env.NODE_ENV == 'production') {
            res.sendfile('./public/html/pages/index-cdn.html');
        }
        else {
            res.sendfile('./public/html/pages/index.html');
        }
    }

    // GET Home Page
    app.get('/', function(req, res) {
        redirectToHome(res);
    });
}

module.exports = commonRoutes;