I have two dynamic pieces of a URL that I'm trying to join together to make a full URL. Since I don't know the exact strings I'll be joining, I want to use a path-joining library to avoid string-joining errors like
var path = require('path'),
joined = path.join('http://www.mysite.com/', '/friends/family');
URLs aren't filesystem paths, so nothing in
path is applicable to your requirements. I'd suggest using
url.resolve() if it meets your needs, or
url.format() if not. Note that you can't simply substitute either for
path.join() in your code, since they require different arguments. Read the documentation carefully.