Update and handle url change in the node server JavaScript code