added promise api to server connection in index.js