Sign inSign up

ricardovergutz/json-server

By ricardovergutz

Updated over 2 years ago

JSON Server provides REST API mocking based on plain JSON.

Image
API management
1

298

ricardovergutz/json-server repository overview

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

Usage

This docker image is available as a trusted build on the docker index⁠, so there's no setup required. Using this image for the first time will start a download automatically. Further runs will be immediate, as the image will be cached locally.

The recommended way to run this container looks like this:

$ docker run -p 8080:8080 -v /home/user/db.json:/data/db.json ricardovergutz/json-server

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

http://localhost:8080/

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", "title": "a title", "views": 100 },
      { "id": "2", "title": "another title", "views": 200 }
    ],
    "comments": [
      { "id": "1", "text": "a comment about post 1", "postId": "1" },
      { "id": "2", "text": "another comment about post 1", "postId": "1" }
    ],
    "profile": {
      "name": "typicode2"
    }
  }

Tag summary

Content type

Image

Digest

sha256:f71e5df1b

Size

77.2 MB

Last updated

over 2 years ago

docker pull ricardovergutz/json-server