初始化SSE服务端项目

This commit is contained in:
2025-07-01 20:07:24 +08:00
commit 2f899e8792
11 changed files with 1199 additions and 0 deletions

22
config/index.js Normal file
View 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个请求
}
};