0

I want my UI to get data through my node server, where each is an independent container. How to connect them using docker-compose file?

i have three container that run mongodb, node server and oracle jet for ui, i wanna access the node APIs through the oraclejet UI so and the mongo db through the node so i defined this docker-compose. the link between mongo and node work.

version: "2"
services:
  jet:
    container_name: sam-jet
    image: amazus/sam-ui
    ports:
      - "8000:8000"
    links:
      - app
    depends_on:
      - app 
  app:
    container_name: sam-node
    restart: always
    image: amazus/sam-apis
    ports:
      - "3000:3000"
    links:
      - mongo
    depends_on:
      - mongo  
  mongo:
    container_name: sam-mongo
    image: amazus/sam-data
    ports:
      - "27017:27017" 

In my oracle jet i define the URI as "http://localhost:3000/sam" but didn't work and i tried "http://app:3000/sam" after reading this one accessing a docker container from another another container but also i doesn't work

1 Answers1

0

OJET just needs a working end point to fetch data, really does not matter where and what stack it is hosted. Once you are able to get the nodeJS service working and the URL works from a browser, it should work from the JET app as well. There may be CORS related headers that you need to set up at server side as well.

Anand Nath
  • 31
  • 4