This package, `jsgi-node`, functions as an adapter to execute JSGI (JavaScript Gateway Interface) middleware within the Node.js environment. It specifically implements the JSGI 0.3 specification, which includes support for promise-based asynchronous operations, aligning with Node.js's non-blocking I/O model. JSGI is an asynchronous middleware interface conceived with design principles akin to WSGI in Python or Rack in Ruby, promoting straightforward and efficient middleware connectivity through JavaScript closures. While `jsgi-node` itself does not bundle JSGI components, it provides the runtime necessary for existing JSGI middleware stacks, often found in older projects such as Pintura. The package, currently at version 0.3.3, received its last significant updates over a decade ago. It is considered an abandoned project, primarily of historical interest, and is generally unsuitable for contemporary Node.js application development due to its reliance on an outdated CommonJS draft specification.
npm install jsgi-nodeVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to create a basic "Hello World" JSGI application and host it as a standard Node.js HTTP server using `jsgi-node`'s `Listener` function, including server startup and graceful shutdown.
Migrate to a modern middleware framework like Express, Koa, or Fastify. This package is not viable for contemporary development.
Use `const pkg = require('jsgi-node')` in CommonJS modules. For ESM, consider using `import pkg from 'jsgi-node'` after configuring `node`'s `--experimental-json-modules` or `createRequire` for interoperability, though compatibility issues with the underlying code will persist.Adopt modern, actively maintained middleware standards and frameworks (e.g., Express, Koa).
Replace with an actively maintained HTTP server or middleware solution.
Ensure the promise library used (e.g., `promised-io`) is present and correctly integrated. For custom promise objects, verify they strictly adhere to Promises/A+ specification.
Run `npm install jsgi-node` in your project directory.
Ensure your file is a CommonJS module (e.g., a `.js` file without `"type": "module"` in `package.json`) and use `const jsgiNode = require('jsgi-node');`.Ensure the incoming request body is correctly parsed and passed to the JSGI app, and that any promise for `request.body` resolves to an iterable suitable for `join()`. This often implies issues with how input streams are handled or promised.
Ensure all promises, especially those returned by your JSGI application, include `.catch()` handlers to explicitly manage errors. Review the promise implementation if `promised-io` or similar is not explicitly used.