cli-ns 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env ADDED
@@ -0,0 +1,3 @@
1
+ STATIC_PATH=./dist
2
+ PORT=8997
3
+ PROXYS=[{"path":"/jshERP-boot","target":"http://10.0.8.221:9997"}]
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 陈彬发
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ <!--
2
+ * @Description:
3
+ * @Autor: fage
4
+ * @Date: 2022-08-04 15:29:35
5
+ * @LastEditors: fage
6
+ * @LastEditTime: 2022-10-10 14:53:08
7
+ -->
8
+ # mini-static-webserver
9
+ node.js开发的简单的静态文件服务器
10
+
11
+ ## 特性
12
+ - 不依赖Express等第三方模块;
13
+ - 参数可配置;
14
+ - 大小仅34K,非常小巧方便;
15
+ - 支持gzip压缩;
16
+
17
+
18
+ ## 使用方法
19
+
20
+ 修改webconfig.js文件,配置一下静态文件目录和监听端口即可
21
+
22
+ ### 配置
23
+ ``` javascript
24
+ {
25
+ staticPath:'./public', //静态文件目录
26
+ private_folder: ["config", "app_data"],//禁止访问目录
27
+ listen_port: 3002,//监听端口
28
+ defaultFile:["index.shtml","index.html","index.htm","default.htm","default.html","home.html"],//默认首页文件名
29
+ gzip: true, //是否启用gzip压缩
30
+ cache: true, //是否开启缓存
31
+ ...
32
+ }
33
+ ```
34
+
35
+ ### 运行
36
+ ``` javascript
37
+ git clone https://gitee.com/chen-binfa/mini-static-webserver.git
38
+ cd mini-static-webserver
39
+ node app
40
+ ```
package/bin/app.js ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ function run(argv) {
3
+ if (argv[0] === "-v" || argv[0] === "--version") {
4
+ console.log(" version is 0.0.1");
5
+ } else if (argv[0] === "-h" || argv[0] === "--help") {
6
+ console.log(" usage:\n");
7
+ console.log(" -v --version [show version]");
8
+ }
9
+ return "version is 1.0.1";
10
+ }
11
+ run(process.argv.slice(2));
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "cli-ns",
3
+ "version": "1.0.0",
4
+ "description": "node.js开发的简单的静态文件服务器",
5
+ "main": "app.js",
6
+ "scripts": {
7
+ "start": "node ./src/app.js",
8
+ "build": "esbuild ./src/app.js --bundle --minify --outfile=./bin/app.js --platform=node"
9
+ },
10
+ "type": "module",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://gitee.com/chen-binfa/mini-static-webserver.git"
14
+ },
15
+ "bin": {
16
+ "ns": "./bin/app.js"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "dotenv": "^17.2.3",
23
+ "http-proxy": "^1.18.1"
24
+ }
25
+ }
@@ -0,0 +1 @@
1
+ hello