The url. resolve Method in node. js is described in node. jsurl. resolve.
Method description:
Insert or replace the original tag for the URL or href. (You can see the example if you don't understand it)
Syntax:
Copy codeThe Code is as follows:
Url. resolve (from,)
Because this method belongs to the url module, You need to introduce the url module (var url = require ("url") before use "))
Receiving parameters:
From Source Address
To tag to be added or replaced
Example:
Copy codeThe Code is as follows:
Var url = require ('url ');
Var a = url. resolve ('/one/two/three', 'four '),
B = url. resolve ('HTTP: // example.com/','/one '),
C = url. resolve ('HTTP: // example.com/one', '/two ');
Console. log (a + "," + B + "," + c );
// Output result:
/// One/two/four
// Http://example.com/one
// Http://example.com/two
Source code:
Copy codeThe Code is as follows:
Url. prototype. resolve = function (relative ){
Return this. resolveObject (urlParse (relative, false, true). format ();
};