Skip to content

Commit

Permalink
House lookup endpoint added. Still needs alot of love. Also some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanmik committed Mar 29, 2013
1 parent f290fdd commit 116db2d
Show file tree
Hide file tree
Showing 7 changed files with 318 additions and 98 deletions.
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

1 change: 0 additions & 1 deletion endpoints/car/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ lookup = function(req, res, next){
var data = req.params;

if(!data.number){
h.logError(error,error.stack);
res.json(431,{error:'Please provide a valid number to lookup'});
return next();
}
Expand Down
40 changes: 40 additions & 0 deletions endpoints/domainlookup/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,44 @@
//Possible endpoint:
//https://www.isnic.is/is/whois/mini.php?type=all&query=apis.is
exports.setup = function(){
server.get({path: '/whois', version: '1.0.0'}, slash);
}

slash = function(req, res, next){

var data = req.params;

if(!data.url) data.url = '';

var url = 'http://www.isnic.is/is/whois/mini.php?type=all&query='+data.url;

request.get({
headers: {'User-Agent': h.browser()},
url: url
}, function(error, response, body){
if(error){
res.json(500,{error:"Something went wrong on the server"});
return next();
}
var data = $(body),
obj = { results: []};


console.log(data.find("h3").html())
console.log($("h3").html())
if(data.find("h3").length > 0){
var obj = {
found: false
};
res.json(200,obj)
}else{
res.json({"fannst":true})
}

h.logVisit('/whois', obj,false);

res.end();
//res.json(200,obj)
return next();
});
}
Loading

0 comments on commit 116db2d

Please sign in to comment.