build: 更新项目结构和配置

- 移除 .gitignore 中的多个文件和目录
- 删除 README.md 文件
- 移除 app.vue 文件
- 删除 nuxt.config.ts 文件
This commit is contained in:
2025-04-24 11:59:10 +08:00
parent 89c4ebddfa
commit 2d46b89d28
13 changed files with 48 additions and 11873 deletions

23
.gitignore vendored
View File

@@ -1,24 +1 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist
# Node dependencies
node_modules
# Logs
logs
*.log
# Misc
.DS_Store
.fleet
.idea
# Local env files
.env
.env.*
!.env.example

View File

@@ -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.

View File

@@ -1,6 +0,0 @@
<template>
<div>
<NuxtRouteAnnouncer />
<NuxtWelcome />
</div>
</template>

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -1,2 +0,0 @@
User-Agent: *
Disallow:

12
server/src/index.ts Normal file
View 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}`);
});

View 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;

View File

@@ -1,8 +1,8 @@
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> => {
@@ -18,8 +18,10 @@ export const getConnection = (): Promise<mysql.PoolConnection> => {
};
// 执行查询
export const query = async (sql: string, values?: any[]): Promise<any> => {
const connection = await getConnection();
export const query = async (sql: string, values?: any[], connection?: mysql.PoolConnection): Promise<any> => {
if (!connection) {
connection = await getConnection()
}
return new Promise((resolve, reject) => {
connection.query(sql, values, (err, results) => {
connection.release(); // 释放连接

View File

@@ -1,3 +0,0 @@
{
"extends": "../.nuxt/tsconfig.server.json"
}

View File

@@ -1,4 +0,0 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}