◐ Shell
clean mode source ↗

GitHub - iaoiui/docker-json-server: JSON Server docker image, REST API mocking based on plain JSON

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

Requirement

Docker Docker-compose(optional)

Usage

Run just following command.

$ docker run -d -p 3000:3000 -v your_db.json:/data/db.json iaoiui/json-server

By Putting your_db.json in the directory which is same as the root directory of this repository, You can get same result with docker-compose.

The above example exposes the JSON Server REST API on port 3000, so that you can now browse to:

JSON source

If you mount a file to /data/db.json (as in the above example), it will automatically be used as the plain JSON data source file.

A sample file could look like this:

{
  "posts": [
    { "id": 1, "body": "foo" },
    { "id": 2, "body": "bar" }
  ],
  "comments": [
    { "id": 1, "body": "baz", "postId": 1 },
    { "id": 2, "body": "qux", "postId": 2 }
  ]
}