質問

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

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top