https://github.com/typicode/json-server
$ docker run -d \
-p 8080:80 \
-v `pwd`:/data/ \
besutome/json-server
-d will run a detached instance in the background-p {OutsidePort}:80 will bind the webserver to the given outside port-v {AbsolutePathToJsonFile}:/data/db.json should be passed to mount the given JSON file into the container{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
module.exports = function() {
var data = { users: [] }
// Create 1000 users
for (var i = 0; i < 1000; i++) {
data.users.push({ id: i, name: 'user' + i })
}
return data
}
docker pull besutome/json-server:latest