feat(auth): 添加认证模块和图片批注功能(项目初始化)
- 实现用户登录、登出、密码修改等认证功能 - 添加会话管理和权限控制中间件 - 创建图片批注组件和相关API路由 - 实现批注的增删改查功能 - 添加Docker和Git忽略配置文件 - 创建系统架构文档和开发约定说明 - 集成认证模块到前端应用路由中
This commit is contained in:
37
api/server.ts
Normal file
37
api/server.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* local server entry file, for local development
|
||||
*/
|
||||
import app from './app.js';
|
||||
import { closeDatabase } from './database.js';
|
||||
|
||||
/**
|
||||
* start server with port
|
||||
*/
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
const server = app.listen(PORT, () => {
|
||||
console.log(`Server ready on port ${PORT}`);
|
||||
});
|
||||
|
||||
/**
|
||||
* close server
|
||||
*/
|
||||
process.on('SIGTERM', () => {
|
||||
console.log('SIGTERM signal received');
|
||||
server.close(async () => {
|
||||
await closeDatabase();
|
||||
console.log('Server closed');
|
||||
process.exit(0);
|
||||
});
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
console.log('SIGINT signal received');
|
||||
server.close(async () => {
|
||||
await closeDatabase();
|
||||
console.log('Server closed');
|
||||
process.exit(0);
|
||||
});
|
||||
});
|
||||
|
||||
export default app;
|
||||
Reference in New Issue
Block a user