The problem is as follows

The server starts working, but as soon as I make requests to the database, it gives this error

error infra/server/handler.js ::ffff:127.0.0.1 called redemption.list and it failed (async) due to Error: getaddrinfo ENOTFOUND postgres postgres:5432 at errnoException (dns.js:28:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26) 

Controller code

  const pg = require ('../../infra/pg') module.exports = { list } function list(){ return pg.select('*').from('orders') } 
  • Apparently, he did not find the server postgres. Did you link him up? - D-side
  • What do you mean? - Max Vovk
  • I mean that he could not understand what to contact on the postgres hostname, which you have in the URL. Have you done anything to have the container you need under this name? - D-side
  • no, did not. How to fix it? - Max Vovk
  • Maybe they did, just do not know. Can you provide a file for Docker Compose? It is enough to define postgres services and their consumers. - D-side

0