{"id":28539335,"url":"https://github.com/yourtion/node-erest","last_synced_at":"2025-07-08T00:38:58.261Z","repository":{"id":23963982,"uuid":"100267690","full_name":"yourtion/node-erest","owner":"yourtion","description":"快速构建 Rest API 并自动生成API文档、Swagger、Postman文件与测试","archived":false,"fork":false,"pushed_at":"2025-05-28T03:46:30.000Z","size":958,"stargazers_count":9,"open_issues_count":14,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T18:49:17.937Z","etag":null,"topics":["api-docs","api-test","easy-rest","express-rest-api","markdown","node-erest","node-restful","rest-api","rest-doc","supertest","swagger"],"latest_commit_sha":null,"homepage":"https://erest.js.org/","language":"TypeScript","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/yourtion.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":"2017-08-14T12:57:34.000Z","updated_at":"2025-05-27T13:49:45.000Z","dependencies_parsed_at":"2024-09-11T14:06:30.427Z","dependency_job_id":null,"html_url":"https://github.com/yourtion/node-erest","commit_stats":{"total_commits":322,"total_committers":3,"mean_commits":"107.33333333333333","dds":"0.021739130434782594","last_synced_commit":"689dc5e718fb6faec9880f5a6b305e0b356d57bf"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/yourtion/node-erest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-erest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-erest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-erest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-erest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yourtion","download_url":"https://codeload.github.com/yourtion/node-erest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-erest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261441423,"owners_count":23158476,"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-docs","api-test","easy-rest","express-rest-api","markdown","node-erest","node-restful","rest-api","rest-doc","supertest","swagger"],"created_at":"2025-06-09T18:31:37.724Z","updated_at":"2025-07-08T00:38:58.252Z","avatar_url":"https://github.com/yourtion.png","language":"TypeScript","readme":"[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![David deps][david-image]][david-url]\n[![node version][node-image]][node-url]\n[![npm download][download-image]][download-url]\n[![npm license][license-image]][download-url]\n[![DeepScan grade](https://deepscan.io/api/projects/2707/branches/19046/badge/grade.svg)](https://deepscan.io/dashboard#view=project\u0026pid=2707\u0026bid=19046)\n\n[npm-image]: https://img.shields.io/npm/v/erest.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/erest\n[travis-image]: https://img.shields.io/travis/yourtion/node-erest.svg?style=flat-square\n[travis-url]: https://travis-ci.org/yourtion/node-erest\n[coveralls-image]: https://img.shields.io/coveralls/yourtion/node-erest.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/yourtion/node-erest?branch=master\n[david-image]: https://img.shields.io/david/yourtion/node-erest.svg?style=flat-square\n[david-url]: https://david-dm.org/yourtion/node-erest\n[node-image]: https://img.shields.io/badge/node.js-%3E=_10-green.svg?style=flat-square\n[node-url]: http://nodejs.org/download/\n[download-image]: https://img.shields.io/npm/dm/erest.svg?style=flat-square\n[download-url]: https://npmjs.org/package/erest\n[license-image]: https://img.shields.io/npm/l/erest.svg\n\n# node-erest\n\n通过简单的方式构建一个优秀的 API 服务（基于 express、@leizm/web 等）。\n\n一个优秀的 API 必须要有优秀的文档、较完整的测试，同时便于开发部署与联调。在文档方面，最大的问题在于，随着 API 的发展需要找人同步更新文档。有个更好的方案是不脱离代码自更新文档。\n\n通过 ERest，你可以在定义 API 的同时，完成参数模型的定义、API格式的定义，同时生成便于写 API 测试的脚手架，像调用本地方法一样写 API 测试，并自动完成 API 文档的生成（包括示例数据），同时生成 Swagger、Postman、基于 axios 的 js-sdk（更多功能支持自定义）。\n\n使用 (generator-erest)[https://github.com/yourtion/node-generator-erest] 帮助你快速生成一个 API 项目框架。\n\n## Install\n\n```bash\n$ npm install erest --save\n```\n\n### Use yeoman generator\n\n```bash\n$ npm install generator-erest -g\n# Express\n$ yo erest:express\n# @leizm/web\n$ yo erest:lei-web\n```\n\n## How to use\n\n```javascript\n'use strict';\n\nconst API = require('erest').default;\n\n// API info for document\nconst INFO = {\n  title: 'erest-demo',\n  description: 'Easy to write, easy to test, easy to generate document.',\n  version: new Date(),\n  host: 'http://127.0.0.1:3000',\n  basePath: '/api',\n};\n\n// API group info\nconst GROUPS = {\n  Index: '首页',\n};\n\n// Init API\nconst apiService = new API({\n  info: INFO,\n  groups: GROUPS,\n});\n\napiService.api.get('/index')\n  .group('Index')\n  .title('Test api')\n  .register((req, res) =\u003e {\n    res.end('Hello, API Framework Index');\n  });\n\nconst express = require('express');\nconst app = express();\nconst router = new express.Router();\napp.use('/api', router);\n\n// bing express router\napiService.bindRouter(router, apiService.checkerExpress);\n\napp.listen(3000, function () {\n  console.log('erest-demo listening started');\n});\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourtion%2Fnode-erest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyourtion%2Fnode-erest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourtion%2Fnode-erest/lists"}