Subtheme of barrio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 lines
668 B

var url = require("url");
var http = require("http");
/**
* @param localUrl
* @param urlPath
* @returns {*}
*/
function createUrl(localUrl, urlPath) {
return url.parse(url.resolve(localUrl, urlPath));
}
/**
* @param url
* @param cb
*/
function verifyUrl(url, cb) {
url.headers = {
"accept": "text/html"
};
http.get(url, function (res) {
if (res.statusCode === 200) {
cb(null, res);
} else {
cb("not 200");
}
}).on("error", function(e) {
console.log("Got error: " + e.message);
});
}
module.exports.createUrl = createUrl;
module.exports.verifyUrl = verifyUrl;