1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-24 08:52:31 +02:00
dockerfiles/json-server
2017-05-08 07:05:07 +08:00
..
db.json add json-server 2016-05-09 10:58:59 +08:00
docker-compose.yml add json-server 2016-05-09 10:58:59 +08:00
Dockerfile swith to new domain: easypi.pro 2017-05-08 07:05:07 +08:00
README.md update json-server 2016-05-09 11:21:31 +08:00

json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously) with json-server.

docker-compose.yml

json-server:
  image: vimagick/json-server
  command: -w db.json
  ports:
    - "3000:3000"
  volumes:
    - ./db.json:/app/db.json
  restart: always

db.json

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

up and running

docker-compose up -d

pip install httpie

http GET :3000/posts
http POST :3000/posts id:=2 title=hello author=world
http PUT :3000/posts/2 title=Hello author=World
http PATCH :3000/posts/2 title=HELLO
http DELETE :3000/posts/2
http GET :3000/db