Stability: 0 - Deprecated: Use the WHATWG URL API instead.

    • from {string} The Base URL being resolved against.
    • to {string} The HREF URL being resolved.

    The url.resolve() method resolves a target URL relative to a base URL in a manner similar to that of a Web browser resolving an anchor tag HREF.

    1. const url = require('url');
    2. url.resolve('/one/two/three', 'four'); // '/one/two/four'
    3. url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
    4. url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'