{"id":21004798,"url":"https://github.com/halfzebra/json-server-example","last_synced_at":"2026-03-19T18:24:15.958Z","repository":{"id":73688687,"uuid":"59892198","full_name":"halfzebra/json-server-example","owner":"halfzebra","description":"An exapmple of using json-server to mock REST API","archived":false,"fork":false,"pushed_at":"2016-07-14T11:27:59.000Z","size":2,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T10:14:11.776Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halfzebra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-28T11:51:58.000Z","updated_at":"2016-07-14T08:55:06.000Z","dependencies_parsed_at":"2023-02-25T11:00:23.841Z","dependency_job_id":null,"html_url":"https://github.com/halfzebra/json-server-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Fjson-server-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Fjson-server-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Fjson-server-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Fjson-server-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halfzebra","download_url":"https://codeload.github.com/halfzebra/json-server-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243419577,"owners_count":20287913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T08:38:03.301Z","updated_at":"2025-12-30T10:21:09.369Z","avatar_url":"https://github.com/halfzebra.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"### Running json-server\n\nThis example shows, how to run a local json-server for development purposes.\n\nEdit `db.json` to alter the data, received from the endpoint.\n\nThis example does not use a global installation of json-server.\n\nFind more details on the original repository of [json-server][json-server]\n\n#### Usage\n\nClone the repository and start your own project.\n\n```bash\n$ git clone git@github.com:halfzebra/json-server-example.git my-project\n$ cd my-project/\n$ rm -rf .git\n$ git init\n```\n\nInstall the latest [Node.js](https://nodejs.org/en/), install dependencies and start the server.\n\n```bash\n$ npm i      # install deps\n$ npm start  # start the server, using script\n```\n\n#### Use in JavaScript\n\nYou might use [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to send a request to the endpoint.\n\n```js\nvar request = new Request('http://localhost:3004/posts/', {\n  headers: new Headers({\n    'Content-Type': 'application/json'\n  })\n});\n\nfetch(request)\n  .then(function(res) {\n    return res.json();\n  })\n  .then(function(data) {\n    // Response data\n  })\n  .catch(function(err) {\n    // Error\n  });\n```\n\n[json-server]: \u003chttps://github.com/typicode/json-server\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalfzebra%2Fjson-server-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalfzebra%2Fjson-server-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalfzebra%2Fjson-server-example/lists"}