Gitlab@Informatics

Skip to content
Snippets Groups Projects
Select Git revision
  • 3095c0ea18fedc94cd85170d7bcea962d3d14dfa
  • main default protected
  • revert
  • 64160159
  • 64160292
  • 64160073
  • html-v_page
  • 64160174
  • 64160072
  • 64160295
  • production
11 results

2023_04_06_032422_user.php

Blame
  • db.js 655 B
    const mysql = require("mysql2/promise")
    
    // Create connection pool
    const pool = mysql.createPool({
      host: process.env.DB_HOST || "localhost",
      user: process.env.DB_USER || "root",
      password: process.env.DB_PASSWORD || "",
      database: process.env.DB_NAME || "test_dashboard3",
      waitForConnections: true,
      connectionLimit: 10,
      queueLimit: 0,
    })
    
    // Test connection
    async function testConnection() {
      try {
        const connection = await pool.getConnection()
        console.log("Connected to database")
        connection.release()
      } catch (err) {
        console.error("Database connection error: " + err.stack)
      }
    }
    
    testConnection()
    
    module.exports = pool