{"library":"pixl-server","title":"Pixl Server Daemon Framework","description":"Pixl-server is a generic server daemon framework for Node.js, designed to provide a foundational layer for building custom server applications such as web backends. It offers essential services like configuration file loading, command-line argument parsing, and robust logging capabilities out-of-box. The core differentiator is its plug-in component system, allowing developers to extend server functionality with pre-built or custom components (e.g., pixl-server-web for HTTP serving, pixl-server-api for JSON APIs). The current stable version is 1.0.50. Based on the provided release history, it appears to follow a slow, incremental release cadence within its 1.x major version, with initial release 1.0.0. This framework enables developers to quickly set up and manage daemon processes with modular, extensible functionality.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install pixl-server"],"cli":null},"imports":["const PixlServer = require('pixl-server');","const WebServer = require('pixl-server-web');","require('pixl-server-api')"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const PixlServer = require('pixl-server');\nconst path = require('path');\nconst fs = require('fs');\n\n// Create dummy directories for demonstration\nconst logDir = path.join(__dirname, 'log');\nconst htdocsDir = path.join(__dirname, 'www');\n\nif (!fs.existsSync(logDir)) fs.mkdirSync(logDir, { recursive: true });\nif (!fs.existsSync(htdocsDir)) fs.mkdirSync(htdocsDir, { recursive: true });\nfs.writeFileSync(path.join(htdocsDir, 'index.html'), '<h1>Hello from Pixl-Server!</h1>');\n\nlet server = new PixlServer({\n\t__name: 'MyWebServer',\n\t__version: \"1.0.50\",\n\tconfig: {\n\t\t\"log_dir\": logDir, // Use local log directory\n\t\t\"debug_level\": 9,\n\t\t\n\t\t\"WebServer\": {\n\t\t\t\"http_port\": 8080, // Use a non-privileged port\n\t\t\t\"http_htdocs_dir\": htdocsDir, // Use local htdocs directory\n\t\t\t\"http_ip_address\": \"127.0.0.1\" // Explicitly bind to localhost\n\t\t}\n\t},\n\t\n\tcomponents: [\n\t\trequire('pixl-server-web')\n\t]\n\t\n});\n\nserver.startup( function(err) {\n\tif (err) {\n\t\tconsole.error(\"Server startup failed:\", err);\n\t\tprocess.exit(1);\n\t}\n\tconsole.log(`MyWebServer v${server.__version} started on http://127.0.0.1:8080`);\n\tconsole.log(`Serving static files from: ${htdocsDir}`);\n\tconsole.log(\"Press Ctrl+C to stop the server.\");\n\t\n\t// Handle graceful shutdown\n\tprocess.on('SIGINT', () => {\n\t\tconsole.log(\"\\nShutting down server...\");\n\t\tserver.shutdown(() => {\n\t\t\tconsole.log(\"Server shut down gracefully.\");\n\t\t\tprocess.exit(0);\n\t\t});\n\t});\n} );","lang":"javascript","description":"This quickstart demonstrates how to initialize a Pixl-Server instance, integrate the `pixl-server-web` component to serve static files, and handle graceful shutdown. It sets up a basic web server listening on port 8080, serving an 'index.html' from a local 'www' directory.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}