feat: Implement backend API and basic frontend structure
Adds initial backend API endpoints for fetching users and attendances, including basic filtering. Sets up the frontend routing with a layout component and includes placeholder pages for dashboard, users, and login. Refactors the README for local development setup.
This commit is contained in:
28
backend/db.js
Normal file
28
backend/db.js
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
const mysql = require('mysql2/promise');
|
||||
|
||||
// Configuração da conexão com o banco de dados
|
||||
// Em produção, estes valores devem vir de variáveis de ambiente (.env)
|
||||
const pool = mysql.createPool({
|
||||
host: '162.240.103.190',
|
||||
user: 'agenciac_comia',
|
||||
password: 'Blyzer@2025#',
|
||||
database: 'agenciac_comia',
|
||||
waitForConnections: true,
|
||||
connectionLimit: 10,
|
||||
queueLimit: 0,
|
||||
// Opções de SSL podem ser necessárias dependendo do servidor,
|
||||
// mas vamos tentar sem SSL inicialmente dado o host.
|
||||
});
|
||||
|
||||
// Teste de conexão simples ao iniciar
|
||||
pool.getConnection()
|
||||
.then(connection => {
|
||||
console.log('✅ Conectado ao MySQL com sucesso!');
|
||||
connection.release();
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('❌ Erro ao conectar ao MySQL:', err.message);
|
||||
});
|
||||
|
||||
module.exports = pool;
|
||||
Reference in New Issue
Block a user