Replaces manual url creation by native url formating method

It replaces the manual url creation by `string concatenation` with the safer, native, `url.format()` method.

This is not a bug fix, just a slight improvement that delegates url handling to Node.js's core `url` module.