p3x-redis-ui-server
Version:
🏍️ P3X Redis UI server — Socket.IO backend for the dual Angular + React frontend with AI queries, 54 languages, and auto data decompression
2 lines (1 loc) • 1.01 kB
JavaScript
import"corifeus-utils";import o from"./cli.mjs";import s from"./console-stamp.mjs";import r from"../service/http/index.mjs";import e from"../service/socket.io/index.mjs";export default async()=>{if(global.p3xrs={},p3xrs.cfg=void 0,!await o())return;s(),p3xrs.http=new r,await p3xrs.http.boot(),p3xrs.socketIo=new e,await p3xrs.socketIo.boot({httpService:p3xrs.http}),p3xrs.redisConnections={},p3xrs.redisConnectionsSubscriber={},process.on("uncaughtException",o=>{console.error("Uncaught Exception:",o)});const t=async o=>{console.info(`Received ${o}, shutting down gracefully...`);try{if(p3xrs.socketIo?.socketio&&p3xrs.socketIo.socketio.close(),p3xrs.redisConnections)for(const o of Object.keys(p3xrs.redisConnections))try{p3xrs.redisConnections[o]?.ioredis&&p3xrs.redisConnections[o].ioredis.disconnect()}catch{}p3xrs.http?.server&&p3xrs.http.server.close()}catch(o){console.error("Error during shutdown:",o)}process.exit(0)};process.on("SIGTERM",()=>t("SIGTERM")),process.on("SIGINT",()=>t("SIGINT"))};