I have the next docker-compose file:
version: "3"
services:
proxy:
build:
context: ./client
dockerfile: proxy.Dockerfile
ports:
- "80:80"
server:
build:
context: .
dockerfile: server.Dockerfile
ports:
- "3000:3000"
depends_on: [db]
db:
image: postgres
environment:
POSTGRES_USER: lautidamo
POSTGRES_PASSWORD: la12papa
POSTGRES_DB: product-manager
ports:
- "5432:5432"
And i have this database.ts:
import { Sequelize } from "sequelize";
export const sequelize = new Sequelize(
"product-manager",
"lautidamo",
"la12papa",
{
dialect: "postgres",
host: "localhost",
port: 5432
}
);
The proxy and the server services works fine. But when I make a request to a route where have to connect to the database, i have this error connect ECONNREFUSED 127.0.0.1:5432.