{"library":"srvx","title":"srvx: Universal Web Standard Server","type":"library","description":"srvx is a modern, zero-dependency HTTP server framework built on Web Standards (Request/Response API), enabling consistent deployment and execution across multiple JavaScript runtimes including Node.js, Deno, and Bun. It currently stands at version 0.11.15, with active development primarily focusing on bug fixes and performance enhancements in its frequent patch releases. A key differentiator is its emphasis on Web Standard APIs, providing a unified programming model regardless of the underlying runtime. It also boasts a full-featured Command Line Interface (CLI) that includes a file watcher, error handling, static file serving, and logging, streamlining the development workflow. srvx aims for close-to-native performance, especially in Node.js environments.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install srvx"],"cli":{"name":"srvx","version":null}},"imports":["import { createServer } from 'srvx'","import { Server } from 'srvx'","// my-handler.js\nexport default {\n  fetch(req: Request) {\n    return new Response('Hello from CLI handler!');\n  },\n};"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://srvx.h3.dev","github":"https://github.com/h3js/srvx","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/srvx","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import { createServer } from 'srvx';\n\nconst server = createServer((req: Request) => {\n  const url = new URL(req.url);\n\n  if (url.pathname === '/health') {\n    return new Response('OK', { status: 200, headers: { 'Content-Type': 'text/plain' } });\n  }\n\n  if (url.pathname.startsWith('/api/greet')) {\n    const name = url.searchParams.get('name') || 'World';\n    return new Response(`Hello, ${name}!`, { headers: { 'Content-Type': 'text/plain' } });\n  }\n\n  return new Response(`Welcome to srvx! You accessed: ${url.pathname}\\nTry /api/greet?name=Alice or /health`, {\n    headers: { 'Content-Type': 'text/plain' },\n  });\n});\n\nconst PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;\n\nserver.listen(PORT, () => {\n  console.log(`srvx server listening on http://localhost:${PORT}`);\n  console.log('Test with:');\n  console.log(`- curl http://localhost:${PORT}/`);\n  console.log(`- curl http://localhost:${PORT}/health`);\n  console.log(`- curl \"http://localhost:${PORT}/api/greet?name=User\"`);\n});","lang":"typescript","description":"This quickstart demonstrates how to programmatically create and run an srvx server that handles basic routing using Web Standard Request and Response objects. It sets up a health check endpoint and a personalized greeting API, listening on a configurable port.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}