Skip to content

Commit

Permalink
Merge branch 'package-fix' of git://github.com/neonstalwart/persevere…
Browse files Browse the repository at this point in the history
…-example-wiki

Conflicts:
	jsgi/redirect-root.js
	package.json
  • Loading branch information
kriszyp committed Oct 1, 2011
2 parents 6c1ebbb + 7f7a82e commit c814334
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion lib/jsgi/redirect-root.js → jsgi/redirect-root.js
@@ -1,9 +1,12 @@
exports.RedirectRoot = function(Redirect, app){
var redirector = Redirect("/Page/Example");
// var redirector = Redirect("/Page/Example");
var redirector = require("./redirect").Redirect("/Page/Example");
exports.RedirectRoot = function(app){
return function(request){
if(request.pathInfo == "/"){
return redirector(request);
}
return app(request);
};
};
};
29 changes: 29 additions & 0 deletions jsgi/redirect.js
@@ -0,0 +1,29 @@
var uri = require("url");

exports.Redirect = function (path, status) {

status = status || 301;

return function (request) {
var location =
(request.scheme || "http") +
"://" +
(request.headers.host || (
request.host +
(request.port == 80 ? "" : ":" + request.port)
)) +
(request.scriptName || "") +
request.pathInfo;

location = path ? uri.resolve(location, path) : request.headers.referer;

return {
status: status,
headers: {
"location": location,
"content-type": "text/plain"
},
body: ['Go to <a href="' + location + '">' + location + "</a>"]
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "persevere-example-wiki",
"author": "",

"version": "0.0.0",
"contributors": [],
"mappings":{
"perstore": "http://github.com/kriszyp/perstore/zipball/v0.2.4!/",
Expand All @@ -19,5 +19,12 @@
"jsgi-node": "jar:http://github.com/kriszyp/jsgi-node/zipball/v0.2.5!/lib/jsgi-node.js",
"multi-node": "http://github.com/kriszyp/multi-node/zipball/v0.2.2!/",
"tunguska": "http://github.com/kriszyp/tunguska/zipball/v0.2.3!/"
},
"dependencies": {
"pintura": ">=0.2.6",
"promised-io": ">=0.2.2",
"commonjs-utils": ">=0.2.2",
"multi-node": ">=0.2.3",
"transporter": ">=0.0.1"
}
}
File renamed without changes.

0 comments on commit c814334

Please sign in to comment.