Gabriele Ferro Home

APIs and Microservices Project – URL Shortener - Part 2

Day 97: 11 December 2020

**Today’s Progress:**

Yesterday, I have started the URL Shortener Microservice project on freeCodeCamp but I didn't finish it.

The code did not handle the case of duplicates but it returned an error instead of providing the existing database entry.

I had to write the GET route to perform the redirection to the original url when the user enters the short url.

Here is my solution:

Yesterday / Today

Now if the user tries to enter an address that is already in our database, we retrieve the information with the method findOne. Then, we send a response in JSON format containing the desired information.

The findOne method is also used for the route GET. The user will enter and address and using this method we retrieve the corresponding original url. Then, we redirect the user to the original-url page using Express.

**Thoughts:**

Since yesterday I have a terrible back pain….

**Link to tweet:**

**Link to work:**

https://boilerplate-project-urlshortener.gbriele.repl.co

[twitter-follow screen_name='20Gabriele20']

February 2024
MTWTFSS
 1234
567891011
12131415161718
19202122232425
26272829 

Archives

Gabriele Ferro Home
Copyright © Ferro Gabriele. All rights reserved.