{"id":15102745,"url":"https://github.com/isaccanedo/json-server-api-rest","last_synced_at":"2026-01-19T04:32:22.508Z","repository":{"id":234951901,"uuid":"789793556","full_name":"isaccanedo/json-server-api-rest","owner":"isaccanedo","description":":basket: Get a full fake REST API with zero coding in less than 30 seconds (seriously)","archived":false,"fork":false,"pushed_at":"2024-04-21T15:19:53.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T22:45:43.926Z","etag":null,"topics":["json","json-api","json-mock","json-schema","json-server"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isaccanedo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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}},"created_at":"2024-04-21T15:16:34.000Z","updated_at":"2024-04-21T15:21:48.000Z","dependencies_parsed_at":"2024-04-21T20:25:47.192Z","dependency_job_id":null,"html_url":"https://github.com/isaccanedo/json-server-api-rest","commit_stats":null,"previous_names":["isaccanedo/json-server-api-rest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaccanedo%2Fjson-server-api-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaccanedo%2Fjson-server-api-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaccanedo%2Fjson-server-api-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaccanedo%2Fjson-server-api-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isaccanedo","download_url":"https://codeload.github.com/isaccanedo/json-server-api-rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332525,"owners_count":20921852,"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":["json","json-api","json-mock","json-schema","json-server"],"created_at":"2024-09-25T19:05:52.173Z","updated_at":"2026-01-19T04:32:22.502Z","avatar_url":"https://github.com/isaccanedo.png","language":"JavaScript","funding_links":["https://github.com/sponsors/typicode"],"categories":[],"sub_categories":[],"readme":"# json-server\n\n[![Node.js CI](https://github.com/typicode/json-server/actions/workflows/node.js.yml/badge.svg)](https://github.com/typicode/json-server/actions/workflows/node.js.yml)\n\n\u003e [!IMPORTANT]\n\u003e Viewing alpha v1 documentation – usable but expect breaking changes. For stable version, see [here](https://github.com/typicode/json-server/tree/v0)\n\n## Install\n\n```shell\nnpm install json-server\n```\n\n## Usage\n\nCreate a `db.json` or `db.json5` file\n\n```json\n{\n  \"posts\": [\n    { \"id\": \"1\", \"title\": \"a title\", \"views\": 100 },\n    { \"id\": \"2\", \"title\": \"another title\", \"views\": 200 }\n  ],\n  \"comments\": [\n    { \"id\": \"1\", \"text\": \"a comment about post 1\", \"postId\": \"1\" },\n    { \"id\": \"2\", \"text\": \"another comment about post 1\", \"postId\": \"1\" }\n  ],\n  \"profile\": {\n    \"name\": \"typicode\"\n  }\n}\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eView db.json5 example\u003c/summary\u003e\n\n```json5\n{\n  posts: [\n    { id: '1', title: 'a title', views: 100 },\n    { id: '2', title: 'another title', views: 200 },\n  ],\n  comments: [\n    { id: '1', text: 'a comment about post 1', postId: '1' },\n    { id: '2', text: 'another comment about post 1', postId: '1' },\n  ],\n  profile: {\n    name: 'typicode',\n  },\n}\n```\n\nYou can read more about JSON5 format [here](https://github.com/json5/json5).\n\n\u003c/details\u003e\n\nPass it to JSON Server CLI\n\n```shell\n$ npx json-server db.json\n```\n\nGet a REST API\n\n```shell\n$ curl http://localhost:3000/posts/1\n{\n  \"id\": \"1\",\n  \"title\": \"a title\"\n}\n```\n\nRun `json-server --help` for a list of options\n\n## Sponsors ✨\n\n|                                                                                    Sponsors                                                                                    |\n| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\n|                         \u003ca href=\"https://mockend.com/\" target=\"_blank\"\u003e\u003cimg src=\"https://jsonplaceholder.typicode.com/mockend.svg\" height=\"70px\"\u003e\u003c/a\u003e                          |\n| \u003ca href=\"https://www.storyblok.com/\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/typicode/json-server/assets/5502029/c6b10674-4ada-4616-91b8-59d30046b45a\" height=\"40px\"\u003e\u003c/a\u003e |\n|  \u003ca href=\"https://betterstack.com/\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/typicode/json-server/assets/5502029/44679f8f-9671-470d-b77e-26d90b90cbdc\" height=\"40px\"\u003e\u003c/a\u003e  |\n\n[Become a sponsor and have your company logo here](https://github.com/users/typicode/sponsorship)\n\n## Sponsorware\n\n\u003e [!NOTE]\n\u003e This project uses the [Fair Source License](https://fair.io/). Only organizations with 3+ users are kindly asked to contribute a small amount through sponsorship [sponsor](https://github.com/sponsors/typicode) for usage. __This license helps keep the project sustainable and healthy, benefiting everyone.__\n\u003e \n\u003e For more information, FAQs, and the rationale behind this, visit [https://fair.io/](https://fair.io/).\n\n## Routes\n\nBased on the example `db.json`, you'll get the following routes:\n\n```\nGET    /posts\nGET    /posts/:id\nPOST   /posts\nPUT    /posts/:id\nPATCH  /posts/:id\nDELETE /posts/:id\n\n# Same for comments\n```\n\n```\nGET   /profile\nPUT   /profile\nPATCH /profile\n```\n\n## Params\n\n### Conditions\n\n- ` ` → `==`\n- `lt` → `\u003c`\n- `lte` → `\u003c=`\n- `gt` → `\u003e`\n- `gte` → `\u003e=`\n- `ne` → `!=`\n\n```\nGET /posts?views_gt=9000\n```\n\n### Range\n\n- `start`\n- `end`\n- `limit`\n\n```\nGET /posts?_start=10\u0026_end=20\nGET /posts?_start=10\u0026_limit=10\n```\n\n### Paginate\n\n- `page`\n- `per_page` (default = 10)\n\n```\nGET /posts?_page=1\u0026_per_page=25\n```\n\n### Sort\n\n- `_sort=f1,f2`\n\n```\nGET /posts?_sort=id,-views\n```\n\n### Nested and array fields\n\n- `x.y.z...`\n- `x.y.z[i]...`\n\n```\nGET /foo?a.b=bar\nGET /foo?x.y_lt=100\nGET /foo?arr[0]=bar\n```\n\n### Embed\n\n```\nGET /posts?_embed=comments\nGET /comments?_embed=post\n```\n\n## Delete\n\n```\nDELETE /posts/1\nDELETE /posts/1?_dependent=comments\n```\n\n## Serving static files\n\nIf you create a `./public` directory, JSON Serve will serve its content in addition to the REST API.\n\nYou can also add custom directories using `-s/--static` option.\n\n```sh\njson-server -s ./static\njson-server -s ./static -s ./node_modules\n```\n\n## Notable differences with v0.17\n\n- `id` is always a string and will be generated for you if missing\n- use `_per_page` with `_page` instead of `_limit`for pagination\n- use Chrome's `Network tab \u003e throtling` to delay requests instead of `--delay` CLI option\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaccanedo%2Fjson-server-api-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisaccanedo%2Fjson-server-api-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaccanedo%2Fjson-server-api-rest/lists"}