docker-json-server icon indicating copy to clipboard operation
docker-json-server copied to clipboard

add routing possibility

Open mbaniasad opened this issue 7 years ago • 2 comments

the --route option is not there it would be nice if you add it

mbaniasad avatar Apr 13 '17 08:04 mbaniasad

Probably something you can do without compose as well, but cause I had this at hand and in case this turns out being helpful this is how you get it done using docker-compose

  jsonserver:
    image: clue/json-server
    container_name: jsonserver
    volumes:
      - ./db.json:/data/db.json
      - ./routes.json:/data/routes.json
    entrypoint:
      - json-server
      - db.json
      - --routes
      - routes.json
      - -p 80
    ports:
      - 4444:80

Note the 4444:80 is just personal setting to have something to take a peek at the json-server (localhost:4444/) This also replies to the ~year old docker-compose support question so linking it. #3

Allu2 avatar Apr 19 '17 03:04 Allu2

If you override the entrypoint in your docker-compose.yaml you can pass the --routes argument:

    volumes:
      - ./secrets.json:/data/db.json
      - ./routes.json:/data/routes.json
    entrypoint: ["bash", "/run.sh", "--routes /data/routes.json"]

rawyler avatar Jun 01 '23 12:06 rawyler