Pergunta

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

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top