{"library":"servez","title":"Simple Command-Line HTTP Server","description":"Servez is a straightforward command-line HTTP server designed for local development and learning, serving static files quickly. As of version 2.4.0, it offers zero-configuration defaults but provides a rich set of options for customization, including port selection, directory listing, CORS headers, gzip/brotli compression, and basic authentication. Its primary differentiator is its simplicity and ease of use, aiming to replace tools like `http-server` with a modern, actively maintained alternative. It supports both HTTP and HTTPS (with self-signed or custom certificates) and can display QR codes for easy mobile access. The project appears to have a regular, albeit not fixed, release cadence, driven by user needs and feature enhancements, making it a reliable choice for development server needs.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install servez"],"cli":{"name":"servez","version":null}},"imports":["servez [options] [path]","npx servez [options] [path]","npm install -g servez"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const { spawn } = require('child_process');\nconst path = require('path');\nconst fs = require('fs');\n\nconst publicDir = path.join(__dirname, 'public');\nif (!fs.existsSync(publicDir)) {\n  fs.mkdirSync(publicDir);\n}\nfs.writeFileSync(path.join(publicDir, 'index.html'), '<h1>Hello, Servez from JS!</h1>');\nfs.writeFileSync(path.join(publicDir, 'style.css'), 'body { font-family: sans-serif; }');\n\nconsole.log('Starting servez...');\nconst servezProcess = spawn('npx', ['servez', publicDir, '--port', '8080', '--dirs', '--cors', '--qr', '--local', '--index'], {\n  stdio: 'inherit',\n  shell: true // Needed on Windows for npx to be found\n});\n\nservezProcess.on('error', (err) => {\n  console.error('Failed to start servez process:', err);\n});\n\nservezProcess.on('exit', (code) => {\n  console.log(`servez process exited with code ${code}`);\n});\n\nconsole.log('Server should be available at http://localhost:8080');\nconsole.log('Press Ctrl+C to stop this script and the servez server.');\n","lang":"javascript","description":"Demonstrates how to programmatically start `servez` from a Node.js script, creating a public directory with sample content and serving it on port 8080 with directory listings, CORS, QR code, and local access enabled.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}