{"id":16434857,"url":"https://github.com/zce/dashboard-server","last_synced_at":"2025-03-21T04:33:05.430Z","repository":{"id":19319594,"uuid":"86055989","full_name":"zce/dashboard-server","owner":"zce","description":"A JSON file RESTful API with authorization based on json-server","archived":false,"fork":false,"pushed_at":"2024-01-22T04:36:51.000Z","size":394,"stargazers_count":52,"open_issues_count":6,"forks_count":22,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-12T08:50:32.873Z","etag":null,"topics":["fake","json-api","json-server","jsonwebtoken","jwt","now","rest-api","restful"],"latest_commit_sha":null,"homepage":"https://dashboard-server.now.sh","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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},"funding":{"github":"zce"}},"created_at":"2017-03-24T10:25:33.000Z","updated_at":"2024-09-16T09:51:43.000Z","dependencies_parsed_at":"2023-12-01T23:27:15.865Z","dependency_job_id":"b5de4095-8e85-48f3-adcc-62e293ff3943","html_url":"https://github.com/zce/dashboard-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fdashboard-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fdashboard-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fdashboard-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fdashboard-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zce","download_url":"https://codeload.github.com/zce/dashboard-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811547,"owners_count":16884366,"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":["fake","json-api","json-server","jsonwebtoken","jwt","now","rest-api","restful"],"created_at":"2024-10-11T08:50:19.024Z","updated_at":"2024-10-28T09:25:33.254Z","avatar_url":"https://github.com/zce.png","language":"JavaScript","readme":"# dashboard-server\n\n[![Build Status][travis-img]][travis-url]\n[![Dependency Status][dependency-img]][dependency-url]\n[![devDependency Status][devdependency-img]][devdependency-url]\n[![Code Style][style-img]][style-url]\n\n\u003e A JSON file RESTful API with authorization based on [json-server](https://github.com/typicode/json-server) for [zce/dashboard](https://github.com/zce/dashboard)\n\n## Usage\n\n```sh\n# clone repo\n$ git clone https://github.com/zce/dashboard-server.git \u003cmy-api-server\u003e\n\n# change directory\n$ cd \u003cmy-api-server\u003e\n\n# install dependencies\n$ yarn # or npm install\n\n# serve with nodemon at http://localhost:3000\n$ yarn dev\n```\n\n## JWT Authorization Endpoints\n\n\u003e with [jsonwebtoken](http://jwt.io)\n\n### POST `/tokens`\n\ncreate token\n\n```sh\n# Content-type: x-www-form-urlencoded\n$ curl -X POST -d \"username=zce\u0026password=wanglei\" http://localhost:3000/tokens\n# Content-type: application/json\n$ curl -X POST -H \"Content-type: application/json\" -d \"{\\\"username\\\":\\\"zce\\\",\\\"password\\\":\\\"wanglei\\\"}\" http://localhost:3000/tokens\n```\n\nrequest body\n\n```js\n{ username: 'zce', password: 'wanglei' }\n```\n\n### GET `/tokens`\n\ncheck token\n\n```sh\n$ curl -H \"Authorization: Bearer \u003cjwt-string\u003e\" http://localhost:3000/tokens\n```\n\nrequest headers\n\n```js\n{\n  headers: { Authorization: 'Bearer \u003cjwt-string\u003e' }\n}\n```\n\n### DELETE `/tokens`\n\nrevoke token\n\n```sh\n$ curl -X DELETE -H \"Authorization: Bearer \u003cjwt-string\u003e\" http://localhost:3000/tokens\n```\n\nrequest headers\n\n```js\n{\n  headers: { Authorization: 'Bearer \u003cjwt-string\u003e' }\n}\n```\n\n## JSON Server Resources Endpoints\n\n- Comments: `/comments/:id?`\n- Posts: `/posts/:id?`\n- Terms: `/terms/:id?`\n- Users: `/users/:id?`\n- Options: `/options/:id?`\n\nTo access and modify resources, you can use any HTTP method: `GET` `POST` `PUT` `PATCH` `DELETE` `OPTIONS`\n\n## Additional Endpoints\n\n### GET `/users/me`\n\nget current login user information\n\n```sh\n$ curl -H \"Authorization: Bearer \u003cjwt-string\u003e\" http://localhost:3000/users/me\n```\n\nrequest headers\n\n```js\n{\n  headers: { Authorization: 'Bearer \u003cjwt-string\u003e' }\n}\n```\n\n## Backdoor Endpoints\n\n### GET `/backdoor/reset`\n\nreset the database to its initial state\n\n```sh\n$ curl http://localhost:3000/backdoor/reset\n```\n\n### GET `/backdoor/delay`\n\nadd a delay of 1000ms for each endpoint\n\n```sh\n$ curl http://localhost:3000/backdoor/delay\n```\n\n## Related\n\n- [zce/locally-server](https://github.com/zce/locally-server) - A JSON file RESTful API without JWT authorization\n\n## License\n\n[MIT](LICENSE) \u0026copy; [汪磊](https://zce.me)\n\n\n\n[travis-img]: https://img.shields.io/travis/com/zce/dashboard-server.svg\n[travis-url]: https://travis-ci.com/zce/dashboard-server\n[dependency-img]: https://img.shields.io/david/zce/dashboard-server.svg\n[dependency-url]: https://david-dm.org/zce/dashboard-server\n[devdependency-img]: https://img.shields.io/david/dev/zce/dashboard-server.svg\n[devdependency-url]: https://david-dm.org/zce/dashboard-server?type=dev\n[style-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n[style-url]: https://standardjs.com/\n","funding_links":["https://github.com/sponsors/zce"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzce%2Fdashboard-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzce%2Fdashboard-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzce%2Fdashboard-server/lists"}