dotgc
dotgc

Reputation: 552

Is there an equivalent of Netscape navigator functions in nodejs?

Can I access the inbuilt navigator functions like isinNet() or DomainNameorHost() from nodejs?

Upvotes: 0

Views: 117

Answers (1)

Paul
Paul

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

Related Questions