{"id":13746500,"url":"https://github.com/ufologist/puer-mock","last_synced_at":"2026-02-01T16:31:38.771Z","repository":{"id":65477680,"uuid":"65978021","full_name":"ufologist/puer-mock","owner":"ufologist","description":"Puer + Mock.js = A configurable mock server with configurable mock(random) data.","archived":false,"fork":false,"pushed_at":"2020-02-29T04:49:06.000Z","size":520,"stargazers_count":499,"open_issues_count":1,"forks_count":63,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-10-19T13:19:00.647Z","etag":null,"topics":["mock-server"],"latest_commit_sha":null,"homepage":"http://ufologist.github.io/puer-mock/","language":"HTML","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/ufologist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-18T08:07:35.000Z","updated_at":"2025-10-11T08:44:44.000Z","dependencies_parsed_at":"2023-01-25T06:45:17.533Z","dependency_job_id":null,"html_url":"https://github.com/ufologist/puer-mock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ufologist/puer-mock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fpuer-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fpuer-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fpuer-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fpuer-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ufologist","download_url":"https://codeload.github.com/ufologist/puer-mock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fpuer-mock/sbom","scorecard":{"id":907211,"data":{"date":"2025-08-11","repo":{"name":"github.com/ufologist/puer-mock","commit":"e5394d682e766907dd9a1122856358f768a2bc1c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T17:46:33.020Z","repository_id":65477680,"created_at":"2025-08-24T17:46:33.020Z","updated_at":"2025-08-24T17:46:33.020Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28982642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T16:29:42.054Z","status":"ssl_error","status_checked_at":"2026-02-01T16:29:41.428Z","response_time":56,"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":["mock-server"],"created_at":"2024-08-03T06:00:54.652Z","updated_at":"2026-02-01T16:31:38.754Z","avatar_url":"https://github.com/ufologist.png","language":"HTML","funding_links":[],"categories":["HTML","JavaScript"],"sub_categories":[],"readme":"# puer-mock\r\n\r\n[![NPM version][npm-image]][npm-url] [![changelog][changelog-image]][changelog-url] [![license][license-image]][license-url]\r\n\r\n[npm-image]: https://img.shields.io/npm/v/puer-mock.svg?style=flat-square\r\n[npm-url]: https://npmjs.org/package/puer-mock\r\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\r\n[license-url]: https://github.com/ufologist/puer-mock/blob/master/LICENSE\r\n[changelog-image]: https://img.shields.io/badge/CHANGE-LOG-blue.svg?style=flat-square\r\n[changelog-url]: https://github.com/ufologist/puer-mock/blob/master/CHANGELOG.md\r\n\r\n[Puer](https://github.com/leeluolee/puer) + [Mock.js](https://github.com/nuysoft/Mock) = A configurable mock server with configurable mock(random) data.\r\n\r\nStart a mock server never ever so easy and configurable, no code needed, you only need config some mock API route and some mock data template, it all done! \r\n\r\n## features\r\n\r\n* mock server\r\n* configurable RESTful API route\r\n  * API request\r\n  * API response mock data\r\n  * validate API request params\r\n* effective immediately when config changed\r\n* JSONP support\r\n* CORS support\r\n* built-in API doc\r\n\r\n## install\r\n\r\nPlease install [puer](https://github.com/leeluolee/puer \"puer 1.x\") first.\r\n\r\n\u003e Puer - more than a live-reload server , built for efficient frontend development\r\n\r\n```\r\nnpm install puer@1.x -g\r\n```\r\n\r\nAnd then install `puer-mock` package in your project root directory.\r\n\r\n```\r\ncd yourprojectdir\r\nnpm install puer-mock\r\n```\r\n\r\nIf your project has a `package.json` file, suggest save `puer-mock` to `devDependencies`.\r\n\r\n```\r\ncd yourprojectrootdir\r\nnpm install puer-mock --save-dev\r\n```\r\n\r\n## usage\r\n\r\n1. copy `node_modules/puer-mock/example` files to your project root directory\r\n2. `cd yourprojectrootdir`\r\n3. `puer -a _mockserver.js`\r\n\r\n   You may define a npm script in `package.json`, then use `npm run dev` next time. \r\n\r\n   ```json\r\n   \"dev\": \"puer -a _mockserver.js\"\r\n   ```\r\n\r\n4. view mock API\r\n  * open `http://localhost:8000/api/configdemo-response/mock` view mock API return mock data\r\n  * open `http://localhost:8000/api/configdemo-response/mock?callback=test` view mock API return mock data by JSONP\r\n  * open `http://localhost:8000/_apidoc.html` view built-in all mock API doc\r\n5. define your mock API in `_mockserver.json`\r\n6. view your mock API(Yes! it with immediate effect)\r\n\r\n## config\r\n\r\nConfig mock API in `_mockserver.json`.\r\n\r\nThe minimal `_mockserver.json`\r\n\r\n```json\r\n{\r\n    \"api\": {\r\n        \"GET /api/users\": {\r\n            \"response\": {}\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nPlease view [mockserver config doc](https://github.com/ufologist/puer-mock/blob/master/_mockserver-config.md) for more detail info.\r\n\r\nYou can see more settings to config mock server in [`_mockserver.json`](https://github.com/ufologist/puer-mock/blob/master/example/_mockserver.json).\r\n\r\n* comment is nice\r\n* config route and mock response data template is so easy\r\n* more data template please see [Mock.js examples](http://mockjs.com/examples.html)\r\n* disable a route is convenient\r\n* mock server will effective immediately when you changed `_mockserver.json`\r\n\r\n## customize\r\n\r\nCustomize launch mock server in `_mockserver.js`. \r\n\r\n* You may customize mock API doc\r\n  * You may customize `/_apidoc` route direct service a more graceful doc\r\n\r\n    ```javascript\r\n    // _mockserver.js\r\n    module.exports = require('puer-mock')(null, null, function(mockConfig) {\r\n        // 任你自由发挥\r\n        return '\u003cpre\u003e' + JSON.stringify(mockConfig, null, 4) + '\u003c/pre\u003e';\r\n    });\r\n    ```\r\n\r\n  * You may customize `/_apidoc.html` which get mock API JSON from `/_apidoc`, you may totally implement it by yourself\r\n\r\n* You may customize config file and launch file\r\n\r\n  If you do not use default `_mockserver.json` or `_mockserver.js`\r\n  \r\n  ```javascript\r\n  // use _mockserver2.json for config file\r\n  //\r\n  // _mockserver.js\r\n  // puer -a _mockserver.js\r\n  module.exports = require('puer-mock')(__filename, './_mockserver2.json');\r\n  ```\r\n\r\n  ```javascript\r\n  // use _mockserver2.js and _mockserver2.json\r\n  //\r\n  // _mockserver2.js\r\n  // puer -a _mockserver2.js\r\n  module.exports = require('puer-mock')(__filename, './_mockserver2.json');\r\n  ```\r\n\r\n* Play it fun with your imagination.\r\n\r\n  ```javascript\r\n  // _mockserver.js\r\n  var puerMock = require('puer-mock');\r\n  var routeConfig = puerMock();\r\n  // 其实你完全可以这样来玩, 在这里接着定义 route 即可, 发挥你的想象力\r\n  // 例如定义一个常用的 500 接口, 来测试服务器报错的情况\r\n  routeConfig['GET /500'] = function(request, response, next) {\r\n      response.status(500).end();\r\n  };\r\n  module.exports = routeConfig;\r\n  ```\r\n\r\n## example\r\n\r\n眼见为实耳听为虚, puer-mock 让你一秒钟就能拥有一个强大的 mock server, 所以请不要再自己手工做假数据了, 赶快尝试一下让你的工作效率翻番吧!\r\n\r\n### 配置 API 并生成随机数据\r\n![puer-mock-example](https://ufologist.github.io/puer-mock/puer-mock-example.png?v1)\r\n\r\n### 查看所有的 API 接口文档\r\n\r\n通过 `/_apidoc.html` 查看接口文档\r\n\r\n![puer-mock-api-doc-html](https://ufologist.github.io/puer-mock/puer-mock-api-doc-html.png?v1)\r\n\r\n通过 `/_apidoc` 直接查看 JSON 数据, 即查看 mock server 配置了哪些 API(使用 [FeHelper 插件](https://www.baidufe.com/fehelper) 格式化了 JSON 数据)\r\n\r\n![puer-mock-api-doc](https://ufologist.github.io/puer-mock/puer-mock-api-doc.png?v1)\r\n\r\n## one more thing\r\n\r\n谁需要这个工具\r\n* 前端/APP端\r\n* 任何与后端接口打交道的人\r\n* [为什么你需要一个 mock server](https://github.com/ufologist/puer-mock/blob/master/why-your-need-a-mock-server.md)\r\n* [推荐与 puer-proxy 一起使用开发时灵活切换 mock 或者后端接口](https://github.com/ufologist/puer-proxy)\r\n* [关于 puer-mock 的讨论](https://www.v2ex.com/t/303650)\r\n* [puer-mock FAQ](https://github.com/ufologist/puer-mock/blob/master/FAQ.md)\r\n* [前后端接口规范](https://github.com/f2e-journey/treasure/blob/master/api.md)\r\n\r\n感谢 puer 提供了如此强大的 mock 机制, 感谢 Mock.js 带来的假数据, 我才有幸做了这么一个扩展工具.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufologist%2Fpuer-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fufologist%2Fpuer-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufologist%2Fpuer-mock/lists"}