{"id":17403,"library":"web","title":"Web HTTP Library (creationix)","description":"The `web` package, also known as `node-web` and authored by `creationix`, is an extremely early-stage (v0.0.2) web/HTTP library for Node.js, last published over a decade ago in January 2013. It was conceived as a lightweight and fast alternative intended to entirely replace Node.js's built-in `http` module and offer a more streamlined approach to web application development than contemporary middleware systems like `connect` or `stack`. Its design was heavily influenced by interface patterns found in `wsgi`, `rack`, `jsgi`, and `strata.js`, emphasizing simple module composition where any function implementing a `(request, respond)` or `(req, res, next)` interface could serve as a valid web application layer. Given its very low version number and the lack of updates for over a decade, this project is considered abandoned and is highly unlikely to be compatible with modern Node.js runtimes or best practices, including native ESM support. Its historical significance lies in exploring alternative HTTP server paradigms during Node.js's formative years.","status":"abandoned","version":"0.0.2","language":"javascript","source_language":"en","source_url":"git://github.com/creationix/node-web","tags":["javascript"],"install":[{"cmd":"npm install web","lang":"bash","label":"npm"},{"cmd":"yarn add web","lang":"bash","label":"yarn"},{"cmd":"pnpm add web","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS only and does not support ES modules. Attempting to use `import` will result in an error in modern Node.js environments.","wrong":"import web from 'web'","symbol":"web","correct":"const web = require('web')"},{"note":"The primary API is accessed via the `web` object directly; destructuring is not typical for this CommonJS pattern in this library's context.","wrong":"const { createServer } = require('web')","symbol":"createServer","correct":"const server = web.createServer(...)"}],"quickstart":{"code":"const web = require('web');\n\nconst app = web.createServer(function (req, res, next) {\n  if (req.url === '/') {\n    res.end('Hello World\\n');\n  } else {\n    next(); // Pass control to the next layer\n  }\n});\n\n// The server object allows for starting and stopping the HTTP listener.\n// In a real application, you might add more complex routing or middleware before app.listen.\napp.listen(8080, () => {\n  console.log('Web server listening on http://localhost:8080/');\n  // To stop the server for testing purposes or graceful shutdown:\n  // setTimeout(() => {\n  //   server.close(() => console.log('Server stopped.'));\n  // }, 5000);\n});","lang":"javascript","description":"Demonstrates creating a basic HTTP server that responds to the root path and passes other requests to the next middleware."},"warnings":[{"fix":"Do not use this package in new projects. For existing projects, significant refactoring to use modern HTTP frameworks (e.g., Express, Koa, Fastify) or Node.js's native `http` module is required.","message":"The package is extremely old (v0.0.2, last updated Jan 2013) and relies on outdated Node.js APIs and patterns. It is highly unlikely to be compatible with modern Node.js versions (e.g., Node.js 14+).","severity":"breaking","affected_versions":">=0.0.2"},{"fix":"Modern Node.js web applications should use the native `http` module directly or popular frameworks that abstract it, rather than a full replacement library from this era.","message":"This library attempts to *replace* the built-in Node.js `http` module. This design choice is fundamentally incompatible with most contemporary Node.js web development, which typically builds upon or coexists with the `http` module, not substitutes it entirely.","severity":"gotcha","affected_versions":">=0.0.2"},{"fix":"Migrate to actively maintained and modern HTTP server solutions or frameworks.","message":"The project is abandoned, with no updates or maintenance for over a decade. It does not support modern JavaScript features, ES Modules (ESM), or current security best practices.","severity":"deprecated","affected_versions":">=0.0.2"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Use `const web = require('web')` and then access methods like `web.createServer`.","cause":"Attempting to destructure `web` module imports (e.g., `const { createServer } = require('web')`). The module exports an object directly, not named properties for destructuring.","error":"TypeError: require(...) is not a function"},{"fix":"This package is not compatible with ES Modules. You would need to either run your application in a CommonJS context or rewrite the application using a modern, ESM-compatible HTTP library.","cause":"Attempting to `import web from 'web'` in an ES Module context. This package is CommonJS-only.","error":"ERR_REQUIRE_ESM"}],"ecosystem":"npm","meta_description":null}