Skip to content

smith/jsgi-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 

Repository files navigation

JSGI 0.3 Adapter for Node

To use, provide a JSGI application (can be application stack) to the start function:

require("jsgi-node").start(function(request){
  var requestBody = request.input.read();
  return {
    status:200,
    headers:{},
    body:["echo: " + requestBody]
  };
});

This adapter should conform to the JSGI 0.3 (with promises) for full asynchronous support. For example:

var posix = require("posix");
require("jsgi-node").start(function(request){
  var promise = new process.Promise();
  posix.cat("jsgi-node.js").addCallback(function(body){
    promise.emitSuccess({
       status: 200,
	   headers: {},
	   body: [body]
   });
  });
  return promise;
});

Hopefully, the Node API will eventually be standardized through CommonJS as the HTTP Event Interface, at which point it would make sense to rename this to hei-jsgi or something like that, to use a standard adapter for any server that implements the API.

About

JSGI Adapter for Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%