feat: 初始化项目结构并添加基础配置
添加前后端基础项目结构,包括.gitignore、package.json等配置文件 实现前端基础功能模块,包括路由、状态管理、API请求封装等 添加前端UI组件库和样式体系 配置开发环境Mock系统和构建工具链
This commit is contained in:
15
back-end/.env
Normal file
15
back-end/.env
Normal file
@@ -0,0 +1,15 @@
|
||||
# Server Configuration
|
||||
PORT=3000
|
||||
|
||||
# Environment
|
||||
NODE_ENV=development
|
||||
|
||||
# API Configuration
|
||||
API_PREFIX=/api
|
||||
|
||||
# Database Configuration (placeholder)
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_NAME=bai_management
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=password
|
||||
2039
back-end/package-lock.json
generated
Normal file
2039
back-end/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
back-end/package.json
Normal file
26
back-end/package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "web-bai-manage-api-server",
|
||||
"version": "1.0.0",
|
||||
"description": "Backend API server for BAI Management System",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"dev": "node src/index.js",
|
||||
"build": "echo 'No build needed for backend'",
|
||||
"test": "echo 'No tests implemented yet'",
|
||||
"lint": "echo 'No linting implemented yet'",
|
||||
"spec:lint": "npx @fission-ai/openspec lint spec/",
|
||||
"spec:validate": "npx @fission-ai/openspec validate spec/"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"dotenv": "^16.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fission-ai/openspec": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.0.0"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
||||
48
back-end/spec/openapi.yaml
Normal file
48
back-end/spec/openapi.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: BAI Management API
|
||||
description: Backend API for BAI Management System
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: http://localhost:3000
|
||||
description: Development server
|
||||
paths:
|
||||
/test-helloworld:
|
||||
get:
|
||||
summary: Test endpoint
|
||||
description: Returns a hello world message
|
||||
responses:
|
||||
'200':
|
||||
description: Successful response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
example: Hello, World!
|
||||
timestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
example: success
|
||||
/health:
|
||||
get:
|
||||
summary: Health check
|
||||
description: Checks if the server is running
|
||||
responses:
|
||||
'200':
|
||||
description: Server is healthy
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: healthy
|
||||
timestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
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