feat: modernized web application

This commit is contained in:
2026-03-31 15:21:08 +09:00
parent f7019403c4
commit 7e07c7ea99
48 changed files with 1569 additions and 103 deletions

23
nextjs/src/lib/db.ts Normal file
View File

@@ -0,0 +1,23 @@
import mysql from 'mysql2/promise';
function createPool(): mysql.Pool {
const port = process.env.DB_PORT ? parseInt(process.env.DB_PORT, 10) : 3306;
return mysql.createPool({
connectionLimit: 10,
port,
host: process.env.DB_ENDPOINT,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: 'catherine_league',
charset: 'utf8mb4',
});
}
let pool: mysql.Pool | undefined;
export function getPool(): mysql.Pool {
if (!pool) {
pool = createPool();
}
return pool;
}