const mysql = require('mysql2');
import type { NextApiRequest, NextApiResponse } from 'next';

export default function Pool(
    req: NextApiRequest,
    res: NextApiResponse<Data>
  ) {
    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;
  }
