mirror of
https://github.com/vimagick/dockerfiles.git
synced 2025-12-21 21:33:02 +01:00
update json-server
This commit is contained in:
@@ -12,7 +12,7 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
json-server:
|
json-server:
|
||||||
image: vimagick/json-server
|
image: vimagick/json-server
|
||||||
command: -H 0.0.0.0 -p 3000 -w db.json
|
command: -h 0.0.0.0 -p 3000 -s ./public db.json
|
||||||
init: true
|
init: true
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
@@ -28,12 +28,32 @@ services:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"posts": [
|
"posts": [
|
||||||
{ "id": 1, "title": "json-server", "author": "typicode" }
|
{
|
||||||
|
"id": "1",
|
||||||
|
"title": "a title",
|
||||||
|
"views": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2",
|
||||||
|
"title": "another title",
|
||||||
|
"views": 200
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"comments": [
|
"comments": [
|
||||||
{ "id": 1, "body": "some comment", "postId": 1 }
|
{
|
||||||
|
"id": "1",
|
||||||
|
"text": "a comment about post 1",
|
||||||
|
"postId": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2",
|
||||||
|
"text": "another comment about post 1",
|
||||||
|
"postId": "1"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"profile": { "name": "typicode" }
|
"profile": {
|
||||||
|
"name": "typicode"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -45,10 +65,10 @@ docker-compose up -d
|
|||||||
pip install httpie
|
pip install httpie
|
||||||
|
|
||||||
http GET :3000/posts
|
http GET :3000/posts
|
||||||
http POST :3000/posts id:=2 title=hello author=world
|
http POST :3000/posts id:=3 title=hello author=world
|
||||||
http PUT :3000/posts/2 title=Hello author=World
|
http PUT :3000/posts/3 title=Hello author=World
|
||||||
http PATCH :3000/posts/2 title=HELLO
|
http PATCH :3000/posts/3 title=HELLO
|
||||||
http DELETE :3000/posts/2
|
http DELETE :3000/posts/3
|
||||||
http GET :3000/db
|
http GET :3000/db
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,29 @@
|
|||||||
{
|
{
|
||||||
"posts": [
|
"posts": [
|
||||||
{ "id": 1, "title": "json-server", "author": "typicode" }
|
{
|
||||||
|
"id": "1",
|
||||||
|
"title": "a title",
|
||||||
|
"views": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2",
|
||||||
|
"title": "another title",
|
||||||
|
"views": 200
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"comments": [
|
"comments": [
|
||||||
{ "id": 1, "body": "some comment", "postId": 1 }
|
{
|
||||||
],
|
"id": "1",
|
||||||
"profile": { "name": "typicode" }
|
"text": "a comment about post 1",
|
||||||
|
"postId": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2",
|
||||||
|
"text": "another comment about post 1",
|
||||||
|
"postId": "1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"profile": {
|
||||||
|
"name": "typicode"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
json-server/data/public/.gitkeep
Normal file
0
json-server/data/public/.gitkeep
Normal file
@@ -2,7 +2,7 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
json-server:
|
json-server:
|
||||||
image: vimagick/json-server
|
image: vimagick/json-server
|
||||||
command: -H 0.0.0.0 -p 3000 -w db.json
|
command: -h 0.0.0.0 -p 3000 -s ./public db.json
|
||||||
init: true
|
init: true
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
|
|||||||
Reference in New Issue
Block a user