Json-server on docker alpine Environment. Please, see Github and NpmJS for more details.
Type docker run
as the example below, to initialise localhost service:
$ docker run -d -P -v /home/user/data:/data -e filename=db.json celsoagra/json-server
Take a look on http://localhost:<port>/
to see resources and methods that can be supported by Json Server.
Here is some file examples:
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
module.exports = () => {
const data = { users: [] }
// Create 1000 users
for (let i = 0; i < 1000; i++) {
data.users.push({ id: i, name: `user${i}` })
}
return data
}
Feel free to use this project and add more features!