feat: implement basic HTTP server with static file serving and error handling

This commit is contained in:
2025-10-05 22:58:56 -05:00
parent 009e72faca
commit 40625a9f74
7 changed files with 1944 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import { startReminderPoller } from "./core/api/reminders";
import { ensureRemindersSchema } from "./core/api/remindersSchema";
import logger from "./core/lib/logger";
import { applyModalSubmitInteractionPatch } from "./core/patches/discordModalPatch";
import { server } from "./server/server";
// Activar monitor de memoria si se define la variable
const __memInt = parseInt(process.env.MEMORY_LOG_INTERVAL_SECONDS || '0', 10);
@@ -163,7 +164,9 @@ process.on('SIGTERM', gracefulShutdown);
async function bootstrap() {
logger.info("🚀 Iniciando bot...");
await server.listen(process.env.PORT || 3000, () => {
logger.info(`📘 Amayo Docs disponible en http://localhost:${process.env.PORT || 3000}`);
});
// Cargar recursos locales (no deberían tirar el proceso si fallan)
try { loadCommands(); } catch (e) { logger.error({ err: e }, 'Error cargando comandos'); }
try { loadComponents(); } catch (e) { logger.error({ err: e }, 'Error cargando componentes'); }