Database module is not working in server.js

Solution for Database module is not working in server.js
is Given Below:

There’s a couple things I’m trying to do on my server.js test. I’m trying to 1)Parse the data into json, but the bodyParser module isn’t working and 2)Serve this json data to my localhost:3000. Here is what I have:

//server.js
const express = require('express');
const bodyParser = require('body-parser');
const db = require('./queries');

const server = express();
const PORT = process.env.PORT || 3000;

server.use(
    bodyParser.urlencoded({
        extended: false
    })
);
server.use(bodyParser.json());

server.get("https://stackoverflow.com/", (req, res) => {
    db.getUsers;
});

server.listen(PORT, ()=>{
    console.log(`Server listening on port ${PORT}...`);
});

And my database query test

//database.js
const Pool = require('pg').Pool;
const pool = new Pool({
    user: 'lorenzodelosreyes',
    host: 'localhost',
    database: 'test_db',
    password: '',
    port: 5432
});

const getUsers = (req, res) => {
    pool.query(`SELECT * FROM test_table`, (error, results) =>{
        if (error) {
            throw error;
        }
        res.status(200).send(results.rows);
    });
}

module.exports = {getUsers};

When I enter the localhost, it just never loads. The code works fine though, as I’ve tried putting it all in one file, but of course I need to practice with modules. What am I doing wrong?

Try this code i change queries to database and change how you call the function.

//server.js
const express = require('express');
const bodyParser = require('body-parser');
const db = require('./database'); // I change this line

const server = express();
const PORT = process.env.PORT || 3000;

server.use(
    bodyParser.urlencoded({
        extended: false
    })
);
server.use(bodyParser.json());

server.get("https://stackoverflow.com/", (req, res) => {
    db.getUsers(req, res); // I change this line
});

server.listen(PORT, ()=>{
    console.log(`Server listening on port ${PORT}...`);
});
//database,js
const Pool = require('pg').Pool;
const pool = new Pool({
    user: 'lorenzodelosreyes',
    host: 'localhost',
    database: 'test_db',
    password: '',
    port: 5432
});

const getUsers = (req, res) => {
    pool.query(`SELECT * FROM test_table`, (error, results) =>{
        if (error) {
            throw error;
        }
        res.status(200).send(results.rows);
    });
}


module.exports = {getUsers};