Reputation: 552
Can I access the inbuilt navigator functions like isinNet() or DomainNameorHost() from nodejs?
Upvotes: 0
Views: 117
Reputation: 27433
Since nodeJS runs on the server, not the browser, you can't access functions that are only provided in a browser.
Most developers use a middleware like Express to create a web service on nodejs.
In a route, such as
app.route("/play", function(req,res){
// code that handles URL /play
});
there is a callback
function that is called when a request arrives for that route.
The req
object parameter contains everything about the request.
req.ip is the upstream (incoming) ip address.
I looked around in npm for a module that might map remote ips to hostnames and could not find one. Presumably all it would do is reverseDNS, which could take time and hold up processing requests.
Upvotes: 1