{"id":11429,"library":"node-http","title":"Node.js HTTP Client Wrapper","description":"This package, `node-http`, provides a minimalistic interface for making HTTP requests within Node.js applications. Originally published over 12 years ago (latest version 0.0.5 from October 2013), it aims to unify the HTTP request process with a chainable API for setting URL, headers, data, and method, alongside event-based callbacks for completion, success, and failure. Due to its age and lack of updates, it is considered abandoned. It exclusively uses CommonJS syntax and does not support modern JavaScript features like Promises or async/await, nor does it officially support contemporary Node.js versions or ESM. Its release cadence was effectively one-off, with no subsequent development. Key differentiators at the time might have been its simplified event-driven approach, but it is now severely outdated compared to actively maintained alternatives like `axios` or Node.js's native `fetch` API.","status":"abandoned","version":"0.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/shallker/node-http","tags":["javascript","node-http"],"install":[{"cmd":"npm install node-http","lang":"bash","label":"npm"},{"cmd":"yarn add node-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-http","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only and does not support ES Modules. Attempting to use `import` syntax will result in an error.","wrong":"import { NodeHttp } from 'node-http';","symbol":"NodeHttp","correct":"const NodeHttp = require('node-http');"},{"note":"The primary interaction is creating an instance of the exported constructor function. The module exports the constructor directly, not a default export.","wrong":"import NodeHttp from 'node-http';\nconst nodeHttp = new NodeHttp();","symbol":"Http instance","correct":"const NodeHttp = require('node-http');\nconst nodeHttp = new NodeHttp();"}],"quickstart":{"code":"const NodeHttp = require('node-http');\nconst nodeHttp = new NodeHttp();\n\n// Example: Perform a GET request\nnodeHttp.GET('http://example.com/data', function (response) {\n  console.log('Success:', response.responseText);\n  console.log('Status Code:', response.statusCode);\n}).fail(function (error) {\n  console.error('Failed to fetch data:', error);\n});\n\n// Example: Perform a POST request with data\nnodeHttp.POST('http://example.com/submit', { key: 'value', id: 123 }, function (response) {\n  console.log('Post Success:', response.responseText);\n}).on('error', function(err) {\n  console.error('Post Error:', err);\n});\n\n// Example: Listening for specific status codes\nnodeHttp.on(200, function(response) {\n  console.log('HTTP 200 OK received for a request.');\n});\n\nnodeHttp.on('Not Found', function(response) {\n  console.error('HTTP 404 Not Found received.');\n});","lang":"javascript","description":"Demonstrates initializing the client, making a GET request, a POST request with data, and handling responses and specific HTTP status events using callbacks."},"warnings":[{"fix":"Migrate to a modern, actively maintained HTTP client library like `axios`, `node-fetch`, or Node.js's built-in `http`/`https` modules, or the native `fetch` API in newer Node.js versions.","message":"This package (v0.0.5) was last published over 12 years ago. It is completely unmaintained and relies on deprecated patterns and old Node.js APIs, making it highly incompatible with modern Node.js versions (v14+).","severity":"breaking","affected_versions":">=0.0.5"},{"fix":"If migration is not an immediate option, configure your project to allow CommonJS imports (e.g., using `require()` in an ESM context via `createRequire` or using build tools that transpile). However, full migration is strongly recommended.","message":"The package uses CommonJS `require()` syntax exclusively and does not provide ES Module exports. This will cause issues in modern Node.js projects configured for ESM or in TypeScript projects targeting ESM.","severity":"breaking","affected_versions":">=0.0.5"},{"fix":"Do not use this package in any environment where security is a concern. Migrate to a well-audited and actively maintained HTTP client library.","message":"Due to its age, this package likely lacks essential security patches for HTTP vulnerabilities (e.g., related to headers, redirects, certificate validation, or data parsing). Using it in production is a significant security risk.","severity":"gotcha","affected_versions":">=0.0.5"},{"fix":"Rewrite HTTP request logic using modern Promise-based APIs or `async/await` with contemporary libraries. If stuck with this package, wrap its calls in custom Promises.","message":"The callback-based API does not support Promises or `async/await`, leading to callback hell and making integration with modern asynchronous JavaScript patterns difficult.","severity":"gotcha","affected_versions":">=0.0.5"},{"fix":"Always instantiate using `new NodeHttp()` after `const NodeHttp = require('node-http');`.","message":"The `NodeHttp` constructor is exposed directly. While the README shows `var nodeHttp = new Http;`, the actual imported name is `NodeHttp`. Using `new Http` after `require('node-http')` would result in a `ReferenceError` unless `Http` was separately defined.","severity":"gotcha","affected_versions":">=0.0.5"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you are using `new NodeHttp()` to create an instance.","cause":"Attempting to call `NodeHttp` without `new` or treating it as a non-constructor function.","error":"TypeError: NodeHttp is not a constructor"},{"fix":"Change `new Http()` to `new NodeHttp()` after `const NodeHttp = require('node-http');`.","cause":"The README uses `new Http()` but the module exports `NodeHttp`. Developers often copy the README literally.","error":"ReferenceError: Http is not defined"},{"fix":"Refactor your project to use modern ESM-compatible HTTP clients, or if absolutely necessary, use `createRequire` to explicitly load the CommonJS module from an ESM file.","cause":"Attempting to `require()` this CommonJS package from an ES Module context in Node.js.","error":"ERR_REQUIRE_ESM"}],"ecosystem":"npm"}