const mariadb = require('mariadb');
const express = require('express');
const app = express();

const serverPort = 3000;

const databaseCredentials = {
    host: 'localhost',
    user: 'fitbot',
    password: 'fitbot123',
    database: 'fitbot',
    connectionLimit: 5,
    allowUnauthorized: true
}

// Create connection pool
const pool = mariadb.createPool(databaseCredentials);

// Register incoming HTTP request handlers
require('incoming_request_handlers')(app, pool);

// Start server
app.listen(port, () => {
    console.log(`Server running on port ${serverPort}`);
})