feat: 初始化项目结构并添加基础配置
添加前后端基础项目结构,包括.gitignore、package.json等配置文件 实现前端基础功能模块,包括路由、状态管理、API请求封装等 添加前端UI组件库和样式体系 配置开发环境Mock系统和构建工具链
This commit is contained in:
35
back-end/src/index.js
Normal file
35
back-end/src/index.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const express = require('express');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
// 加载环境变量
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3000;
|
||||
|
||||
// 解析JSON请求体
|
||||
app.use(express.json());
|
||||
|
||||
// 测试接口
|
||||
app.get('/test-helloworld', (req, res) => {
|
||||
res.json({
|
||||
message: 'Hello, World!',
|
||||
timestamp: new Date().toISOString(),
|
||||
status: 'success'
|
||||
});
|
||||
});
|
||||
|
||||
// 健康检查接口
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({
|
||||
status: 'healthy',
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
});
|
||||
|
||||
// 启动服务器
|
||||
app.listen(port, () => {
|
||||
console.log(`Server running on port ${port}`);
|
||||
console.log(`Test endpoint: http://localhost:${port}/test-helloworld`);
|
||||
console.log(`Health check: http://localhost:${port}/health`);
|
||||
});
|
||||
Reference in New Issue
Block a user