You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
pizza.krasnikov.pro/.history/server/db/connect_20220517190254.ts

31 lines
656 B

const mysql = require('mysql2');
import type { NextApiRequest, NextApiResponse } from 'next';
type Pool = {
name: string
}
const poolConfig = {
connectionLimit: 10,
host: 'example.org',
user: 'bob',
password: 'secret'
};
let pool = mysql.createPool(poolConfig);
export default function Pool(
res: NextApiResponse<Pool>
) {
const pool = mysql.createPool({
host: process.env.HOST,
user: process.env.DATABASE,
database: process.env.DATABASE,
password: process.env.PASSWORD,
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
});
return pool;
}