Tell us what’s happening:
dns.lookup doesn’t work when i get the hostname from the url - it accepts all kinds of strings as valid hostnames. When i test manually with a string containing ‘example’ it works.
I notice no matter what url I submit to your app, the short_url property value is always 1 in the returned JSON. For each unique url, it should change. Also, I am not your why you have other properties in the returned JSON besides the required ones.
Also, you should be using a persistent data source to store the urls in. Everytime you restart the server, the global variable resets back to an empty object and you lose all the urls submitted to it. That is not a practical application.