Hi,
I just figured out that the JSGI example at
http://docs.persvr.org/documentation/server-side-js
(bottom) doesn't work the way it should.
The code is
app = function(env){
if(env["PATH_INFO"] == "somepath"){
return [200, {"Content-Type":"text/html"}, "<html><body>some
content</body></html>"];
}else{
return [404, {}, "Resource could be be found"];
}
};
But this returns an error when making a request to /somepath.
According to an example on
jackjs.org it should be something like
app = function(env){
if(env["PATH_INFO"] == "/somepath"){
return {status:200, headers: {"Content-Type":"text/html"},
body: ["<html><body>some content</body></html>"]};
}else{
return {status:404, headers: {"Content-Type":"text/html"},
body: ["Resource could be be found"]};
}
};
An then it works when requesting /somepath. First you have to return
an object, not an array, and second the leading slash has to be
included when checking PATH_INFO.
Maybe someone can correct this. Thanks!
Regards,
S.F.