A Freecode camp project for the backend certification
-
I can POST to [project_url]/api/shorturl/new and i will receive a shortened URL in the JSON response like
{original_url: "www.google.com", "short_url":1}
-
If i pass an invalid URL that doesn't follow the http(s)://www.example.com(/more/routes) format,the JSON response will contain an error like
{error: "invalid URL"}
HINT: to be sure that the submitted url points to a valid site you can use the functiondns.lookup(host, cb)
from thedns
core module. -
When i visit the shortened URL, it will redirect me to my original link.