title: Host-independent URL from code
body: <p>I need my app to send email with a link back to the app in it.  How do I form the link, no matter which host/port/etc it is running on?  In one place, I do this:</p>
  
  <pre><code>var urlToSend = req.protocol + '://' + req.get('host') + "some/path";
  </code></pre>
  
  <p>But I don't have simple access to the <code>req</code> object in my new case.  That string manipulation seems goofy and error-prone to begin with.  Jumping through hoops to get the request would make it even worse, I think.</p>
  
  <p>Is there something in nodejs like <a href="http://guides.rubyonrails.org/routing.html#path-and-url-helpers" rel="nofollow">url helper functions in rails</a>?</p>