huxy-node-server 1.0.4 → 1.0.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/example.js +10 -1
- package/package.json +2 -2
- package/src/index.js +1 -1
package/example.js
CHANGED
|
@@ -14,11 +14,16 @@ const {app, config, httpServer} = await startServer({
|
|
|
14
14
|
// ...
|
|
15
15
|
}, (config, app, httpServer, logger) => {
|
|
16
16
|
app.get('/config', (req, res) => {
|
|
17
|
-
logger.info('详细配置:'
|
|
17
|
+
logger.info(config, '详细配置:');
|
|
18
18
|
res.status(200).json({
|
|
19
19
|
result: config,
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
+
app.use('/', (req, res) => {
|
|
23
|
+
logger.info({url: req.url}, 'url');
|
|
24
|
+
// logger.info(req.headers, 'headers');
|
|
25
|
+
// logger.info(req.body, 'body');
|
|
26
|
+
});
|
|
22
27
|
});
|
|
23
28
|
|
|
24
29
|
// startStatic
|
|
@@ -26,6 +31,10 @@ const huxyServer = await startStatic({
|
|
|
26
31
|
port: 9000,
|
|
27
32
|
basepath: '/',
|
|
28
33
|
buildPath: './build',
|
|
34
|
+
// ssl: {
|
|
35
|
+
// key: '/path/to/name.key',
|
|
36
|
+
// cert: '/path/to/name.pem',
|
|
37
|
+
// },
|
|
29
38
|
}, (config, app) => {
|
|
30
39
|
logger.info(config);
|
|
31
40
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huxy-node-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "一个精炼、高性能的 Express.js 服务器模板,为现代 Node.js 应用程序设计,提供灵活的功能和最佳实践。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./src/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"express": "^5.2.1",
|
|
41
41
|
"express-rate-limit": "^8.2.1",
|
|
42
42
|
"helmet": "^8.1.0",
|
|
43
|
-
"pino": "^10.1.
|
|
43
|
+
"pino": "^10.1.1",
|
|
44
44
|
"pino-http": "^11.0.0",
|
|
45
45
|
"pino-pretty": "^13.1.3"
|
|
46
46
|
},
|
package/src/index.js
CHANGED
|
@@ -112,7 +112,7 @@ var K = {
|
|
|
112
112
|
port: parseInt(process.env.PORT || '3000', 10),
|
|
113
113
|
host: process.env.HOST || '0.0.0.0',
|
|
114
114
|
basepath: process.env.BASEPATH || '/',
|
|
115
|
-
apiPrefix: '/
|
|
115
|
+
apiPrefix: '/',
|
|
116
116
|
cors: {origin: process.env.CORS_ORIGIN?.split(',') || '*', credentials: !0},
|
|
117
117
|
rateLimit: {
|
|
118
118
|
windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS || '300000', 10),
|