I have a node.js application that builds successfully.
i want to link it with postresql which i posted also on render.io
here are my settings for the postgres (this is a study project, so I don’t worry about posting this data):
here are my settings for the .env file:
PORT=3001
### RENDER
DB=todo_qjbn
HOST=postgres://chaosmos:HHuIdSHUQjWhoO7iCAxWnhYjO0ROULN2@dpg-cf602gla499d72tdg4mg-a.frankfurt-postgres.render.com/todo_qjbn
#POSTGRESQLHOST=dpg-cf602gla499d72tdg4mg-a
PASSWORD=HHuIdSHUQjWhoO7iCAxWnhYjO0ROULN2
PORT=5432
USER=chaosmos
here is my postgres connection settings in code:
export const AppDataSource = new DataSource({
type: 'postgres',
host: process.env.HOST,
port: process.env.PORT,
username: process.env.USER,
password: process.env.PASSWORD,
database: process.env.DB,
entities: [Task],
synchronize: false,
});
const port = process.env.PORT;
AppDataSource
.initialize()
.then(() => {
app.listen(port);
console.log('Data Source has been initialized');
})
.catch((err) => {
console.error('Error!!! during Data Source initialization', err);
});
app.use('/', tasksRouter);
When I build I get this error:
Apparently, something is wrong with the database connection settings
what is the problem and how can i fix this error?