I'm failing to require methods from my ./db/index.js into my server.js file to select data from the database and display it.
The /db/index.js is like this:
'use strict';
const pgp = require('pg-promise')();
const pg = pgp(process.env.DATABASE_URL);
let select = () => {
    pg.any('SELECT username, status FROM status')
        .then(function(data){
            for (var item of data) {
                return item.username + "'s status is " + item.status;
            }
        })
        .catch(function(err) {
            return 'Error: ' + err.message || err;
        });
};
module.exports = () => {
    select
};
and I want to call it in from a different file:
'use strict';
const port = process.env.PORT || 3000;
const bodyParser = require('body-parser');
const express = require('express');
const app = express();
const db = require('./db/');
app.use(bodyParser.urlencoded({extended: true}));
app.post('/logdash', function(req, res, next) {
    res.status(200).send(db.select());
});
app.listen(port, function() {
    console.log('Server is running on port', port);
});
I'm using Heroku, and like this, watching the logs, no error is shown in both terminal and Slack (it's a slash command). I can't find help on how to properly separate the functions. How can I call this select method and any other one from a different file?
 
     
     
    