Update index.js

change how to acquire host name and host IP