初始化SSE服务端项目
This commit is contained in:
22
config/index.js
Normal file
22
config/index.js
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @file 应用配置文件
|
||||
* @author Yk <yk_9001@icloud.com>
|
||||
* @createdAt 2025-07-01
|
||||
* @lastModifiedAt 2025-07-01
|
||||
* @description 包含服务器、SSE和限流配置
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
server: {
|
||||
port: process.env.PORT || 3000,
|
||||
env: process.env.NODE_ENV || 'development'
|
||||
},
|
||||
sse: {
|
||||
heartbeatInterval: 15000, // 15秒
|
||||
allowedOrigins: '*', //process.env.ALLOWED_ORIGINS?.split(',') || ['http://localhost:3001']
|
||||
},
|
||||
rateLimit: {
|
||||
windowMs: 15 * 60 * 1000, // 15分钟
|
||||
max: 100 // 每个IP限制100个请求
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user