build: 更新项目结构和配置
- 移除 .gitignore 中的多个文件和目录 - 删除 README.md 文件 - 移除 app.vue 文件 - 删除 nuxt.config.ts 文件
This commit is contained in:
		
							
								
								
									
										23
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,24 +1 @@ | |||||||
| # Nuxt dev/build outputs |  | ||||||
| .output |  | ||||||
| .data |  | ||||||
| .nuxt |  | ||||||
| .nitro |  | ||||||
| .cache |  | ||||||
| dist |  | ||||||
|  |  | ||||||
| # Node dependencies |  | ||||||
| node_modules | node_modules | ||||||
|  |  | ||||||
| # Logs |  | ||||||
| logs |  | ||||||
| *.log |  | ||||||
|  |  | ||||||
| # Misc |  | ||||||
| .DS_Store |  | ||||||
| .fleet |  | ||||||
| .idea |  | ||||||
|  |  | ||||||
| # Local env files |  | ||||||
| .env |  | ||||||
| .env.* |  | ||||||
| !.env.example |  | ||||||
|   | |||||||
							
								
								
									
										75
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										75
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,75 +0,0 @@ | |||||||
| # Nuxt Minimal Starter |  | ||||||
|  |  | ||||||
| Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more. |  | ||||||
|  |  | ||||||
| ## Setup |  | ||||||
|  |  | ||||||
| Make sure to install dependencies: |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| # npm |  | ||||||
| npm install |  | ||||||
|  |  | ||||||
| # pnpm |  | ||||||
| pnpm install |  | ||||||
|  |  | ||||||
| # yarn |  | ||||||
| yarn install |  | ||||||
|  |  | ||||||
| # bun |  | ||||||
| bun install |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## Development Server |  | ||||||
|  |  | ||||||
| Start the development server on `http://localhost:3000`: |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| # npm |  | ||||||
| npm run dev |  | ||||||
|  |  | ||||||
| # pnpm |  | ||||||
| pnpm dev |  | ||||||
|  |  | ||||||
| # yarn |  | ||||||
| yarn dev |  | ||||||
|  |  | ||||||
| # bun |  | ||||||
| bun run dev |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## Production |  | ||||||
|  |  | ||||||
| Build the application for production: |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| # npm |  | ||||||
| npm run build |  | ||||||
|  |  | ||||||
| # pnpm |  | ||||||
| pnpm build |  | ||||||
|  |  | ||||||
| # yarn |  | ||||||
| yarn build |  | ||||||
|  |  | ||||||
| # bun |  | ||||||
| bun run build |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| Locally preview production build: |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| # npm |  | ||||||
| npm run preview |  | ||||||
|  |  | ||||||
| # pnpm |  | ||||||
| pnpm preview |  | ||||||
|  |  | ||||||
| # yarn |  | ||||||
| yarn preview |  | ||||||
|  |  | ||||||
| # bun |  | ||||||
| bun run preview |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. |  | ||||||
							
								
								
									
										6
									
								
								app.vue
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								app.vue
									
									
									
									
									
								
							| @@ -1,6 +0,0 @@ | |||||||
| <template> |  | ||||||
|   <div> |  | ||||||
|     <NuxtRouteAnnouncer /> |  | ||||||
|     <NuxtWelcome /> |  | ||||||
|   </div> |  | ||||||
| </template> |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| // https://nuxt.com/docs/api/configuration/nuxt-config |  | ||||||
| export default defineNuxtConfig({ |  | ||||||
|   compatibilityDate: '2024-11-01', |  | ||||||
|   devtools: { enabled: true } |  | ||||||
| }) |  | ||||||
							
								
								
									
										11734
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										11734
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										17
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,17 +0,0 @@ | |||||||
| { |  | ||||||
|   "name": "nuxt-app", |  | ||||||
|   "private": true, |  | ||||||
|   "type": "module", |  | ||||||
|   "scripts": { |  | ||||||
|     "build": "nuxt build", |  | ||||||
|     "dev": "nuxt dev", |  | ||||||
|     "generate": "nuxt generate", |  | ||||||
|     "preview": "nuxt preview", |  | ||||||
|     "postinstall": "nuxt prepare" |  | ||||||
|   }, |  | ||||||
|   "dependencies": { |  | ||||||
|     "nuxt": "^3.16.2", |  | ||||||
|     "vue": "^3.5.13", |  | ||||||
|     "vue-router": "^4.5.0" |  | ||||||
|   } |  | ||||||
| } |  | ||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 4.2 KiB | 
| @@ -1,2 +0,0 @@ | |||||||
| User-Agent: * |  | ||||||
| Disallow: |  | ||||||
							
								
								
									
										12
									
								
								server/src/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								server/src/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | import express from 'express'; | ||||||
|  | import roleRoutes from './routes/role.routes'; | ||||||
|  |  | ||||||
|  | const app = express(); | ||||||
|  | const port = 3000; | ||||||
|  |  | ||||||
|  | // 注册路由 | ||||||
|  | app.use('/api', roleRoutes); | ||||||
|  |  | ||||||
|  | app.listen(port, () => { | ||||||
|  |     console.log(`Server is running on http://localhost:${port}`); | ||||||
|  | }); | ||||||
							
								
								
									
										30
									
								
								server/src/routes/role.routes.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								server/src/routes/role.routes.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | import express from 'express'; | ||||||
|  | import { getConnection, query } from '../utils/db.util'; | ||||||
|  |  | ||||||
|  | const router = express.Router(); | ||||||
|  |  | ||||||
|  | // 获取角色列表 | ||||||
|  | router.get('/roles', async (req, res) => { | ||||||
|  |     try { | ||||||
|  |         const connection = await getConnection(); | ||||||
|  |         const results = await query('SELECT * FROM role', [], connection); | ||||||
|  |         res.json(results); | ||||||
|  |     } catch (error) { | ||||||
|  |         console.error('获取角色数据失败:', error); | ||||||
|  |         res.status(500).json({ error: '获取角色数据失败' }); | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | // 获取充值列表 | ||||||
|  | router.get('/recharges', async (req, res) => { | ||||||
|  |     try { | ||||||
|  |         const connection = await getConnection(); | ||||||
|  |         const results = await query('SELECT * FROM recharge', [], connection); | ||||||
|  |         res.json(results); | ||||||
|  |     } catch (error) { | ||||||
|  |         console.error('获取充值列表失败:', error); | ||||||
|  |         res.status(500).json({ error: '获取充值列表失败' }); | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | export default router; | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| import mysql from 'mysql'; | import mysql from 'mysql'; | ||||||
| import { dbConfig } from '../config/db.config'; | import { cdkDbConfig } from '../config/db.config'; | ||||||
|  |  | ||||||
| // 创建连接池 | // 创建连接池 | ||||||
| const pool = mysql.createPool(dbConfig); | const pool = mysql.createPool(cdkDbConfig); | ||||||
|  |  | ||||||
| // 获取数据库连接 | // 获取数据库连接 | ||||||
| export const getConnection = (): Promise<mysql.PoolConnection> => { | export const getConnection = (): Promise<mysql.PoolConnection> => { | ||||||
| @@ -18,8 +18,10 @@ export const getConnection = (): Promise<mysql.PoolConnection> => { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| // 执行查询 | // 执行查询 | ||||||
| export const query = async (sql: string, values?: any[]): Promise<any> => { | export const query = async (sql: string, values?: any[], connection?: mysql.PoolConnection): Promise<any> => { | ||||||
|     const connection = await getConnection(); |     if (!connection) { | ||||||
|  |         connection = await getConnection() | ||||||
|  |     } | ||||||
|     return new Promise((resolve, reject) => { |     return new Promise((resolve, reject) => { | ||||||
|         connection.query(sql, values, (err, results) => { |         connection.query(sql, values, (err, results) => { | ||||||
|             connection.release(); // 释放连接 |             connection.release(); // 释放连接 | ||||||
|   | |||||||
| @@ -1,3 +0,0 @@ | |||||||
| { |  | ||||||
|   "extends": "../.nuxt/tsconfig.server.json" |  | ||||||
| } |  | ||||||
| @@ -1,4 +0,0 @@ | |||||||
| { |  | ||||||
|   // https://nuxt.com/docs/guide/concepts/typescript |  | ||||||
|   "extends": "./.nuxt/tsconfig.json" |  | ||||||
| } |  | ||||||
		Reference in New Issue
	
	Block a user