@shun-js/config 0.3.3 → 0.3.5

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/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @shun-js/config
2
+
3
+ shun.js服务:配置服务
4
+
5
+ ## 配置文件
6
+
7
+ 以`config.json`命名
8
+
9
+ ```json
10
+ {
11
+ "port": 8006
12
+ }
13
+ ```
14
+
15
+ ## 启动
16
+
17
+ ```shell
18
+ # 全局安装该服务
19
+ npm i -g @shun-js/user
20
+
21
+ # 安装shun-cli
22
+ npm i -g @shun-js/shun-cli
23
+
24
+ # 启动,在config.json所在目录下
25
+ shunjs start @shun-js/config
26
+ ```
27
+
28
+ ## 请求
29
+
30
+ ```shell
31
+ curl --location --request POST 'http://localhost:8006/config' \
32
+ --data-urlencode 'type=mp-xiaolouai'
33
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shun-js/config",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "config",
5
5
  "keywords": [
6
6
  "shun.js",
@@ -29,5 +29,5 @@
29
29
  "access": "public",
30
30
  "registry": "https://registry.npmjs.org/"
31
31
  },
32
- "gitHead": "a005429a8440d070d4e66fc9167f091f02f725fd"
32
+ "gitHead": "405fc74a5b002f7399cee6df132c7c2c039be09e"
33
33
  }
@@ -1,6 +1,3 @@
1
- // config
2
- const config = require('../config.json');
3
-
4
1
  /**
5
2
  * config
6
3
  * @param {*} req
@@ -12,5 +9,5 @@ exports.config = async (req, res) => {
12
9
  const type = req.body.type || 'mp-xiaolouai';
13
10
 
14
11
  // r
15
- res.jsonSuccess('success', config[type]);
12
+ res.jsonSuccess('success', global.QZ_CONFIG[type]);
16
13
  };