Permalink
Browse files

added README.md and comment

  • Loading branch information...
1 parent fce4cc9 commit c87b346376b526ed802da144815a170a6bf4ca95 @coolaj86 committed Jun 14, 2012
Showing with 22 additions and 0 deletions.
  1. +20 −0 connect-pathname/README.md
  2. +2 −0 connect-pathname/index.js
View
@@ -0,0 +1,20 @@
+connect-pathname
+===
+
+Adds `req.pathname` and `req.query`
+
+Usage
+===
+
+ (function () {
+ "use strict";
+
+ var connect = require('connect')
+ , pathname = require('connect-pathname')
+ ;
+
+ connect()
+ .use(pathname())
+ ,listen(3000)
+ ;
+ }());
@@ -18,6 +18,8 @@
urlObj = url.parse(req.url);
req.pathname = req.pathname || urlObj.pathname;
+ // since we've already parsed the url, we might
+ // save the duplication and do the query
if (!req.query) {
req.query = req.query || querystring.parse((urlObj.search||"").substr(1));
}

0 comments on commit c87b346

Please sign in to comment.