Sign inSign up

bhsonu/json-server

By bhsonu

•Updated over 6 years ago

JSON Server provides REST API mocking based on plain JSON. This is a docker image that eases setup.

Image
0

957

bhsonu/json-server repository overview

⁠JSON Server Docker Image

JSON Server provides REST API mocking based on plain JSON. This is a docker image that eases setup.

⁠Running your server with your custom data (Recommneted way)

Create db.json file in a directory, add your content

{
    "posts": [
      { "id": 1, "title": "json-server-updated", "author": "typicode32" }
    ],
    "comments": [
      { "id": 1, "body": "some comment new", "postId": 1 }
    ],
    "profile": { "name": "typicode" }
  }

Open terminal in the same directory and run the following command

docker run -p 3001:3000 -v ${pwd}:/data bhsonu/json-server

This will mount your local directory to the data dir of the container

Now open localhost:3001/posts/1

⁠Testing the container

docker run -p 3002:3000 bhsonu/json-server

Tag summary

Content type

Image

Digest

Size

39.6 MB

Last updated

over 6 years ago

docker pull bhsonu/json-server