0

I would like to know how can I display the hostname of the current server running the app. The same application is running on different servers (production, development, local etc). The backend of our application is in Java8, frontend in Javascript and the templating engine is jade.

In Java in backend, it is very simple and straightforward with the following code. How can I display this information in frontend in the application.

I tried looking online but cannot find information on how get the hostname and IP address in frontend (Javascript and Jade).

        InetAddress ip;
        String hostname;

        try {
            ip = InetAddress.getLocalHost();
            hostname = ip.getHostName();
            System.out.println("Your current IP address : " + ip);
            System.out.println("Your current Hostname : " + hostname);

        } catch (UnknownHostException e) {

            e.printStackTrace();
        }
Waleed Asif
  • 159
  • 3
  • 15

0 Answers0