Browse files

Updated docs

  • Loading branch information...
1 parent 7631f25 commit 00a2f137f27f29532b3d54d48c35ebf86fcfad37 @kriszyp kriszyp committed Jul 29, 2010
Showing with 28 additions and 2 deletions.
  1. +28 −2 README.md
View
30 README.md
@@ -16,7 +16,7 @@ function:
This adapter should conform to the JSGI 0.3 (with promises) for full
asynchronous support. For example:
- var fs = require("fs-promise");
+ var fs = require("promised-io/fs");
require("jsgi-node").start(function(request){
return fs.readFile("jsgi-node.js").then(function(body){
return {
@@ -28,4 +28,30 @@ asynchronous support. For example:
});
-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.
+File objects returned from promised-io's fs can be directly provided as body for
+automated streaming of data to the client from the filesystem:
+
+ var fs = require("promised-io/fs");
+ require("jsgi-node").start(function(request){
+ return {
+ status: 200,
+ headers: {},
+ body: fs.open("some-file.txt","r")
+ };
+ });
+
+This package also includes an adapter for running Node HTTP apps on top of JSGI middleware:
+
+ var fs = require("promised-io/fs"),
+ Node = require("jsgi/node").Node;
+ require("jsgi-node").start(
+ SomeJSGIMiddleWare(
+ OtherJSGIMiddleWare(
+ Node(function(request, response){
+ // request and response conform to Node's HTTP API
+ })
+ )
+ )
+ );
+
+

0 comments on commit 00a2f13

Please sign in to comment.