{"id":19057753,"url":"https://github.com/yokiyokiyoki/egg-proxy-view","last_synced_at":"2026-06-23T11:31:41.980Z","repository":{"id":139451828,"uuid":"612028458","full_name":"yokiyokiyoki/egg-proxy-view","owner":"yokiyokiyoki","description":"egg proxy devServer html plugin","archived":false,"fork":false,"pushed_at":"2023-03-12T12:43:56.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T23:32:51.558Z","etag":null,"topics":["devserver","egg-plugin","eggplugin","proxy-html","proxy-server"],"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/yokiyokiyoki.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":"2023-03-10T03:22:08.000Z","updated_at":"2023-09-13T12:39:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"70e13f30-0cd9-4679-8b00-d83ceb20e3e9","html_url":"https://github.com/yokiyokiyoki/egg-proxy-view","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"7823c15958e15eea00845c2b0d29f64dda975057"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yokiyokiyoki/egg-proxy-view","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokiyokiyoki%2Fegg-proxy-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokiyokiyoki%2Fegg-proxy-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokiyokiyoki%2Fegg-proxy-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokiyokiyoki%2Fegg-proxy-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yokiyokiyoki","download_url":"https://codeload.github.com/yokiyokiyoki/egg-proxy-view/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokiyokiyoki%2Fegg-proxy-view/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34686727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["devserver","egg-plugin","eggplugin","proxy-html","proxy-server"],"created_at":"2024-11-08T23:59:26.111Z","updated_at":"2026-06-23T11:31:41.961Z","avatar_url":"https://github.com/yokiyokiyoki.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-proxy-view\n\n[![NPM version][npm-image]][npm-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-proxy-view.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-proxy-view\n\n一般用于代理前端 devServer 的 html，还可以自定义策略代理devServer静态资源以及api\n\n## Install\n\n```bash\n$ npm i egg-proxy-view --save\n```\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.proxyView = {\n  enable: true,\n  package: 'egg-proxy-view',\n};\n```\n\n## Configuration\n\n```js\n// {app_root}/config/config.local.js\nconfig.proxyView = {\n    // default默认是false，就不会启动该插件的中间件\n    open: false,\n    /**\n     * devServer配置\n     */\n    devServer:{\n        host:\"127.0.0.1\",\n        port:8899,\n    },\n    /**\n     * 代理相关资源到devServer\n     */\n    targets: [\n      /^(\\/node_modules)/g，\n      '/assets/(.*)',\n      '/src/(.*)'\n    ],\n  }\n```\n\nsee [config/config.default.js](config/config.default.js) for more detail.\n\n## Example\n\n1. 新增config配置\n\n2. 更改ctx.render为ctx.proxyView.render\n```ts\n@Get('/*')\nasync home() {\n  const ctx = this.ctx;\n  const userAgent = ctx.headers['user-agent'];\n  const mobileReg = /\\s+Mobile/i;\n  const template = mobileReg.test(userAgent) ? 'mobile.html' : 'index.html';\n  // 如果open为false，会自动走ctx.render\n  await ctx.proxyView.render(template, { data: {} });\n}\n```\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyokiyokiyoki%2Fegg-proxy-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyokiyokiyoki%2Fegg-proxy-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyokiyokiyoki%2Fegg-proxy-view/lists"}