{"id":19528705,"url":"https://github.com/renzhezhilu/http-plug","last_synced_at":"2025-04-26T11:33:23.083Z","repository":{"id":57268263,"uuid":"277485946","full_name":"renzhezhilu/http-plug","owner":"renzhezhilu","description":"Node实现的自动刷新无依赖http静态服务器Automatic refresh implemented by Node without dependency on http static server","archived":false,"fork":false,"pushed_at":"2024-06-20T22:27:06.000Z","size":76624,"stargazers_count":9,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T00:31:05.105Z","etag":null,"topics":["html","mini-server","node","pkg","server","static","static-server","static-server-nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renzhezhilu.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":"2020-07-06T08:30:24.000Z","updated_at":"2024-07-14T16:32:32.000Z","dependencies_parsed_at":"2024-10-20T19:05:17.172Z","dependency_job_id":null,"html_url":"https://github.com/renzhezhilu/http-plug","commit_stats":{"total_commits":32,"total_committers":2,"mean_commits":16.0,"dds":0.15625,"last_synced_commit":"98d5c5419e4a9de8c52b23192f9e037adabf96d6"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renzhezhilu%2Fhttp-plug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renzhezhilu%2Fhttp-plug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renzhezhilu%2Fhttp-plug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renzhezhilu%2Fhttp-plug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renzhezhilu","download_url":"https://codeload.github.com/renzhezhilu/http-plug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250980772,"owners_count":21517723,"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":["html","mini-server","node","pkg","server","static","static-server","static-server-nodejs"],"created_at":"2024-11-11T01:19:46.009Z","updated_at":"2025-04-26T11:33:19.665Z","avatar_url":"https://github.com/renzhezhilu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/psd/logo/logo.svg\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/v/http-plug?color=eeb930\u0026logo=npm\u0026style=flat-square\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/http-plug\"\u003e\n\u003cimg alt=\"npm\" src=\"https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/psd/tab/size.svg\"\u003e\n\u003cimg alt=\"npm bundle size\" src=\"https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/psd/tab/ver.svg\"\u003e\n\n\u003c/a\u003e\n\n\u003ca href=\"#03.桌面客户端\"\u003e\n\n\u003cimg alt=\"node-current\" src=\"https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/psd/tab/platform.svg\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/psd/http-plug-newui.png\"\u003e\n\u003c/p\u003e\n\n\n\n\u003ch1\u003ehttp-plug\u003c/h1\u003e\n\n\u003ch3 \u003e基于node实现的无依赖http静态服务器。\u003c/h3\u003e\n\n- [x] 文件改动时html页面会实时刷新\n- [x] 非常迷你, 无依赖, 30KB不到\n- [x] 全局命令, 哪里需要点哪里\n- [ ] 可设置账户登录\n- [ ] 搜索文件\n\n---\n### 介绍\n\n\u0026emsp; \u0026emsp; 一开始我使用[xammp](https://www.apachefriends.org/)里的web server做静态服务器，需求很简单，就是偶尔调试下html。首先我得先把文件拷贝到web server指定的目录下才能访问，虽然可以设置路径，但还是觉得麻烦。\n\n        \n\n\u0026emsp; \u0026emsp; 难道就没有一个可以非常便捷的在任意目录下创建静态服务器的工具吗？\n\n\u0026emsp; \u0026emsp; 就像一个插头🔌, 插上马上就能用。\n\u003e 有啊，[light-server](https://www.npmjs.com/package/light-server) 😒2020-08-08\n\n\u0026emsp; \u0026emsp; 接着我本着尽可能简单的原则，只使用node自带模块来开发这个工具\n\n\n \n\n# 安装\n\n[01.模块安装](#01.模块安装)\n\n[02.单文件运行](#02.单文件运行)\n\n[03.桌面客户端](#03.桌面客户端)\n\n## 01.模块安装\n\n### 全局安装(🚀推荐)\n\n全局环境下安装 `plug` 命令，安装完成之后，我们就可以在任何地方执行 `plug` 命令了\n``` \nnpm i http-plug -g\n```\n\n\u003e 我的实际输入(macOS)：sudo [cnpm](https://developer.aliyun.com/mirror/NPM?from=tnpm) i http-plug -g\n\n进入任意文件夹下输入\n\n``` \ncd \u003c任意文件夹\u003e\nplug\n```\n\n即可在这个文件夹下创建http-plug\n\n使用 `-h`  `-H`  `-help` 获取更多使用帮助\n\n```shell\nplug -h\n```\n\n可用的命令 \n```javascript\nplug                    打开http-plug(默认端口9527)\nplug 8888               使用8888端口打开（失败后则重新随机分配可用端口）\nplug -l | -L            打印日志 \nplug 8888 -l | -L       指定端口并打印日志 \nplug -v | -V            查看版本\nplug -h | -H            帮助\n```\n\n\u003cimg width=\"600\" src=\"https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/psd/http-plug-demo.gif\"\u003e\n\n\n### 局部安装\n\n进入项目文件夹输入\n\n``` \nnpm i http-plug --save-dev\n```\n\n接着使用node自带的 `npx` 启动，获取帮助信息可输入 `npx http-plug -v` \n\n``` \nnpx http-plug\n```\n\n## 02.单文件运行\n\n得益于只使用node原生模块，提供了更多的灵活性\n\n下载[主文件http-plug. js](https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/http-plug.js)文件，放置项目根目录，接着cd这个项目输入下面即可\n\n``` \nnode http-plug.js\n```\n\n## 03.桌面客户端\n使用[pkg](https://github.com/vercel/pkg)生成。\n软件所在的根目录即为服务器的根目录。\n\n\u003e pkg把整个node都打包了，虽然是用了8.0版本的node，但还是很大😒。\n\u003e 试试用[sciter-js-sdk](https://github.com/c-smile/sciter-js-sdk)打包 -2020-10-27\n\u003c!-- \n[下载 windows7/10(21.8 MB)](https://github.com/renzhezhilu/http-plug/releases/download/0.2.13/http-plug-win.exe)\n\n[下载 macOS(33.7 MB)](https://github.com/renzhezhilu/http-plug/releases/download/0.2.13/http-plug-macos)\n\n[下载 linux(32.7 MB)](https://github.com/renzhezhilu/http-plug/releases/download/0.2.13/http-plug-linux)) --\u003e\n\n\u003c!-- # 文件说明\n```\n|_ doc/         文档记录\n|_ html/        html模版\n|_ npm/         npm模块\n|_ pkg/         桌面客户端\n|_ psd/         相关设计\n|_ test/        乱七八糟的测试\n|_ .gitignore   \n|_ http-plug.js 主文件\n|_ readme.md\n\n``` --\u003e\n\n# 使用\n### 界面说明\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/psd/http-plug-UI-what.png\"\u003e\n\u003c/p\u003e\n\n### 命令行\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/renzhezhilu/http-plug/psd/shell.png\"\u003e\n\u003c/p\u003e\n\n# 安全性\nhttp-plug本意是用来开发时调试使用，避免用在生产环境。\n\n# end\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenzhezhilu%2Fhttp-plug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenzhezhilu%2Fhttp-plug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenzhezhilu%2Fhttp-plug/lists"}