FreeCodeCamp Project: URL-Shortener-Microservice API - (GitHub)

Description:

This is a URL shortener API build with Express. When a url is requested, the API will search in the database for that url. If it is found the API will return an object with the original and shortened url. Else, it will store it in the database and return the same object. If the shortened url is requested, the API will redirect to the original url.

Instructions:

  1. Pass a valid URL as a parameter in the request (See Examples).
  2. If the string passed is a valid url, an object is returned containing the original url and the short version.
  3. If the short url is passed as a parameter, the program will redirect to the original url.

Examples:

https://anfelo-url-shortener.glitch.me/api/https://google.com

Output:

{ "original": https://google.com, "short": https://anfelo-url-shortener.glitch.me/4539 }