Hi guys. I think im missing something…
So i hosted a postgres DB on AWS, tried to connect with glitch app, and it wont let me in.
The code i wrote:
database.js for connection
const { Pool } = require('pg');
const pool = new Pool({
user: 'postgres',
host: process.env.DBURL, // <- tried without process.env (just password and url string). nothing.
database: 'postgres',
password: process.env.DBPASS,
port: 5432,
})
module.exports = pool;
then wrote simple app.get test
app.get('/api', function (req, res) {
console.log("API"); // <- i get "API" in console. Then it just does nothing. I get no response.
pool.query("select * from routes").then(data => {
res.send(data.rows);
})
})
P.S. I tried exact code locally and i get query response. Connection is ok.