On Jan 10, 2014, at 16:07, JPJen <[email protected]> wrote:

> What I am interested in doing is to parse a URL, which is 
> http://localhost:port_number/lens/v1/ping, that is sent from a browser.  I 
> would like to compare the pathname of the URL with "/lens/v1/ping" (I hope 
> that I could use == to compare).  If the comparison result is true, I am 
> going to return Status 200 as the response to the browser window..  Somehow, 
> I cannot write that URL parsing statement correctly.  I keep getting 
> TypeError.

As José said, Mikael’s request module does not have a “url” property. Therefore 
it is not a string. That is why you are getting a type error.

I think you’re getting confused between Mikael’s request module:

var req = require('request');

and the req object that node gives you as reference for each request, for 
instance in the example shown on the nodejs homepage:

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1’);

Other than the name “req”, these two variables have nothing in common.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to