{"id":13487688,"url":"https://github.com/DXY-F2E/api-mocker","last_synced_at":"2025-03-27T23:31:24.172Z","repository":{"id":53952773,"uuid":"103627108","full_name":"DXY-F2E/api-mocker","owner":"DXY-F2E","description":"Api Mocker is more of an api management system than a mocker.","archived":false,"fork":false,"pushed_at":"2023-11-10T00:38:43.000Z","size":1277,"stargazers_count":1136,"open_issues_count":7,"forks_count":180,"subscribers_count":46,"default_branch":"main","last_synced_at":"2024-10-29T20:00:42.257Z","etag":null,"topics":["api-management","api-manager","api-mocker","egg","mocker","vue"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DXY-F2E.png","metadata":{"files":{"readme":"README.en.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":"2017-09-15T07:21:26.000Z","updated_at":"2024-08-08T07:28:37.000Z","dependencies_parsed_at":"2024-07-31T20:52:38.777Z","dependency_job_id":"017fec12-94ed-446e-ac56-349c26879859","html_url":"https://github.com/DXY-F2E/api-mocker","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DXY-F2E%2Fapi-mocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DXY-F2E%2Fapi-mocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DXY-F2E%2Fapi-mocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DXY-F2E%2Fapi-mocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DXY-F2E","download_url":"https://codeload.github.com/DXY-F2E/api-mocker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245944055,"owners_count":20697944,"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":["api-management","api-manager","api-mocker","egg","mocker","vue"],"created_at":"2024-07-31T18:01:02.173Z","updated_at":"2025-03-27T23:31:24.136Z","avatar_url":"https://github.com/DXY-F2E.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Applications","应用"],"sub_categories":["插件"],"readme":"# API Management Surface - API Mocker\n\n\u003e API Mocker does not only mock the API, it aims to improve front-end and back end cooperative development by providing a unified API management, and a platform to communicate iterative improvments and maintainence of the API.\n\nClick to view live example ==\u003e [DEMO](http://api-mocker.com/)\n\n**Note: The provided demo demonstrates the look and feel of the project but does not gurantee data security and stability, and may even delete data periodically. Do not use the demo for personal or business projects**\n\n***\n\n## Contents\n- [System Functionality](#system-functionality)\n- [Technology stack and third party libraries](#technology-stack-and-third-party-libraries)\n- [Getting Started](#getting-started)\n- [Deployment Notes](#deployment-notes)\n\n## System Functionality\n\n### API Conventions\n\nAPI Mocker provides a user friendly yet powerful API editior, users can easily define various API behaviors such as:\n\n- Structured parameter input and output\n  - Support different request parameter types (`query`，`body`，`path`, `header`)\n  - Strict parameter checking\n  - Support for data types(`string`，`number`，`boolean`，`object`，`array`)\n  - 参数备注、示例\n- support `JSON` parsing\n- maintains history data\n\n![demo screenshot](https://user-gold-cdn.xitu.io/2017/9/15/e4728e628394957924f586517e8d8b1b)\n\n### Mock data\n\nAPI Mocker believes that the defined mock api should not only be enforced on the response but also in the request conventions. Thus, we provide a production quality mock service\n\n- Mock requests generates fake data based on defined rules\n- Mock api will check the reqest parameters from rules (Check for optionals or correct parameter types)\n- Able to mock various real-life responses such as `200`, `404`, `500` based on user settings\n- Support proxy requests from live or testing evironments, for separation of development environments excluding charles proxy\n- supports [Mock.js](http://mockjs.com/) grammar and conventions\n\n### API documentation\n\nAPI Mocker automatically generates concise, well-structured interface documents based on defined rules. You can also subscribe to API changes individually or in subscription groups, to receive an email when any interface in the subscription list have been added, modified or deleted.\n\n![screenshot of api documentation](https://user-gold-cdn.xitu.io/2017/9/15/bf8a8ab4587aae27ea45047b05de8df7)\n\n### API Authorisation\n\nAPI Mocker provides convinient access control\n\n- group level api control\n- retrieve and write control\n\n### Other capabilities\n\n- API testing: developers can conviniently test the API instead of repeatedly filling up fields with request tools like `postman`\n- Convinient API search (search by url, administrators, etc.)\n- support import from  `RAP`\n\n***\n\n## Technology stack and third party libraries\n\n* ES6\n* ESLint (Standard)\n* [Ramda](https://github.com/ramda/ramda)\n\n### Client\n\n* [Vue](https://github.com/vuejs/vue)全家桶（vue + vuex + vue-router + webpack）\n* [ElementUI](https://github.com/ElemeFE/element), [Mock.js](https://github.com/nuysoft/Mock), etc...\n* Less\n\n### Server\n\n* [Egg](https://github.com/eggjs/egg), [Koa](https://github.com/koajs/koa)\n* [MongoDB](https://github.com/mongodb/mongo)\n* [Mongoose](https://github.com/Automattic/mongoose)\n\n***\n\n## Getting Started\n\nInstallation requires certain external commands(`mongod`)\n\n* `make install`\n\nThis command will also ensure the startup process of `mongod`. If it is not started, it will create the `db` directory locally and start `mongod`.\nIf the server is booted up, re-execute `make install` to ensure the database is started.\n\n## Server Configuration\n\nTo start the project for the first time, you need to manually add the configuration files `./server/config/core.js` and `./server/config/manager.js`\n\nYou can quick start by duplicating `./server/config/default.core.js` and `./server/config/default.manager.js` respectively\n\nNote: core.js contains the configurations for mongo database, md5 key, mail service;\nmanager.js is for initializing new super administrator account.\n\n## Deployment (dev)\n\n### Client\n\n* `make client` or  `cd client \u0026\u0026 npm install \u0026\u0026 npm run dev`\n\n### Server\n\n* `make server` or `cd server \u0026\u0026 npm install \u0026\u0026 npm run dev`\n\n## Deployment (prods)\n\n### Client\n\n* `make prod_client` or `cd client \u0026\u0026 npm install \u0026\u0026 npm run build`\n\n### Server\n\n* `make prod_server` or `cd server \u0026\u0026 npm install \u0026\u0026 npm start`\n\nDefault port number is `7001`\n\n***\n\n\n## Deployment Notes\n\n### Environment requirements\n```json\n\"node\": \"\u003e= 6.0.0\",\n\"npm\": \"\u003e= 3.0.0\"\n```\n### Config - Server\n\nIf you require `https` support, the certificate paths is sent in `server/index.js`. Other server configurations are in the `server/config` such as:\n\n`clientRoot`: client address, currently only used in sending reminder emails;\n\n`transporter`: For mail-related configuration, please set your own push mailbox. Some mail service providers have a high security policy and push errors occur. Please test them yourself. If not configured, the system does not push the email;\n\n`pushInterval`: The mail push interval timings. Currently only this configuration is modified for the api;\n\n`mongoose`: related configuration of mongoDB;\n\n`bodyParser.jsonLimit`: The maximum limit for api request information. Because the amount of data is relatively large when the api is updated, you have to define the limit.\n\nFor other configurations, please see the file comments and [related content](https://eggjs.org/en-us/basics/config.html#container). in the egg.js documentation \n\n### Config - Client\n\nThe client is configured in `client/config/index.js`. among them:\n\n`docsUrl`: The document address, which can be configured to its own git repository;\n\n`serverRoot`: server interface root path;\n\n`assetsPublicPath`: Static file public path, all static file resource addresses, starting with this path. Please configure according to your own release requirements.\n\nFor other related configurations, please refer to the vue-cli scaffolding [webpack template] (https://github.com/vuejs-templates/webpack)\n\n### **Example Deployment with nginx**\n\nSuppose the api-mocker project folder path is `__api_mocker_path`\n\nWith the domain name `your-mocker.com`\n\n1. Deploy (prods), please refer to the [above commands](#deployment-\\(prods\\))\n2. nginx add configuration:\n```bash\nserver {\n\n        listen       80;\n        server_name  localhost;\n\n        location /mock-api/ {\n            proxy_pass http://127.0.0.1:7001/;\n        }\n\n        location /mock {\n            autoindex on;\n            alias __api_mocker_path/client/dist;\n        }\n}\n```\n2. modify the config of `serverRoot` under `client/config/index.js` to `your-mocker.com/mock-api`\n3. visit `http://your-mocker.com/mock`\n\n\u003e Note: If the server bandwidth is low, you can deploy the client to cdn, configure the route, and re-update the `index.html` file cache under the dist directory, Or just synchronize the `client/dist/static` directory to cdn, and then do the forwarding configuration for your own nginx.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDXY-F2E%2Fapi-mocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDXY-F2E%2Fapi-mocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDXY-F2E%2Fapi-mocker/lists"}