{"id":21970746,"url":"https://github.com/whosydd/mock-server","last_synced_at":"2026-04-06T09:32:34.210Z","repository":{"id":121085354,"uuid":"424082804","full_name":"whosydd/mock-server","owner":"whosydd","description":"一个简单的测试服务器","archived":false,"fork":false,"pushed_at":"2021-11-05T10:47:11.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-06T02:16:53.115Z","etag":null,"topics":["express","mockjs"],"latest_commit_sha":null,"homepage":"","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/whosydd.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-03T03:43:07.000Z","updated_at":"2021-11-05T10:47:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"887982c1-3482-43a5-a395-65f7929b72c1","html_url":"https://github.com/whosydd/mock-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/whosydd/mock-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fmock-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fmock-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fmock-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fmock-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whosydd","download_url":"https://codeload.github.com/whosydd/mock-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fmock-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31466614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["express","mockjs"],"created_at":"2024-11-29T14:42:25.325Z","updated_at":"2026-04-06T09:32:34.186Z","avatar_url":"https://github.com/whosydd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mock-server\n\n## 前言\n\n由于只是简单的用来测试接口，所以只封装了常用的`get`、`post`、`patch`、`delete`，如果有其他的需求，可以自行在`src/router/index.js`中进行添加\n\n## 运行\n\n```sh\nnpm start\n```\n\n## 使用\n\n在`src/config/router.json`中配置`path`, `type`, `auth`, `status`, `response`\n\n- path: 请求的路径\n- type: 请求类型\n- auth: 是否返回 token\n- status: 返回状态码，比如在删除数据时，可将其设置为 204，默认 200\n- response: 返回数据，可以使用`mockjs`的语法\n\n```json\n{\n  \"req1\": {\n    \"path\": \"/get\",\n    \"type\": \"get\",\n    \"response\": {\n      \"data\": {\n        \"msg\": \"hello world\",\n        \"name\": \"@name\"\n      }\n    }\n  },\n  \"req2\": {\n    \"path\": \"/post\",\n    \"type\": \"post\",\n    \"auth\": true,\n    \"response\": {\n      \"data\": {\n        \"msg\": \"hello world\",\n        \"name\": \"@name\",\n        \"date\": \"@date\"\n      }\n    }\n  },\n  \"req3\": {\n    \"path\": \"/add\",\n    \"type\": \"post\",\n    \"status\": 201,\n    \"response\": {\n      \"status\": 201,\n      \"data\": {\n        \"msg\": \"hello world\",\n        \"name\": \"@name\",\n        \"date\": \"@date\"\n      }\n    }\n  },\n  \"req4\": {\n    \"path\": \"/patch\",\n    \"type\": \"patch\",\n    \"response\": {\n      \"data\": {\n        \"msg\": \"hello world\",\n        \"name\": \"@name\",\n        \"date\": \"@date\"\n      }\n    }\n  },\n  \"req5\": {\n    \"path\": \"/delete\",\n    \"type\": \"delete\",\n    \"status\": 204\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhosydd%2Fmock-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhosydd%2Fmock-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhosydd%2Fmock-server/lists"}