Let’s discuss your "URL Shortener Microservice"

Hi Josh! Thx for a feedback.

Now I’m using Date.now() to get a short version of url and based on it refactored my solution a little bit. I believe that now it looks not so messy.

1 Like

hi,
I have a QS:
if you random the shorten link, in will create duplicates in your db. how can you avoid it?

I used a randomly generated 4 digit number because the probability of collisions given the amount of people who use it is probably quite low. If this were a large-scale system where I knew many people would be using it, I would have certainly taken more precautions than I did.

A step towards making sure it would be unique would be to use a UUID, but those can be long and unwieldy and basically defeats the point of having a short url.

A different option might be using a combination of letters and numbers to increase the number of possible combinations you could make, and therefore make it slightly less probable that you’ll have a collision.

Another option (and probably the only one that’s a 110% ironclad guarantee) could be generating your x digit number, and then checking against your database to see if it already corresponded to a different URL before creating/saving it to your database. If it already existed and the URLs don’t match, then you could generate another one and repeat that check until you have one that’s unique, then save that one.

Live: https://xys.herokuapp.com/
Code: https://github.com/mtso/url-shortener

I only check for a valid looking url using regex and haven’t implemented a dns lookup to check that the given url actually points to a live website.

My short links aren’t random, but I do query the database for duplicates whenever a “new” url is entered.

If a duplicate already exists, I display the existing short link. If there’s no duplicate, we can create a new entry. Keeps everything nice and clean.

GitHub link

Hope that helps!

Hello, I’m sending you my links, saw some… Learned a lot from this challenge.

Heroku: https://urlshort-vp.herokuapp.com/
Git hub: https://github.com/valeporti/fcc-urlshort

If someone that hasn’t finished needs help, gladly will assist! (Hope I know the answer jeje)

See you!

@lucas-rodrigues20 Super happy to see that a deployment to Glitch/GoMix can be done even with MongoDB!

Howdy everyone,

The source: https://github.com/AllanPooley/fcc-url-shortener
The project live: https://url-decapitator.glitch.me/

Yeah, also found that this project was a bit of a step up.
Some tricky things you’ll have to tackle include:

  • Reading and writing to MongoDB (possibly remotely using something like mLab)
  • Validating a URL
  • Generating a unique short URL.

Found this article pretty handy as a starting point: https://zellwk.com/blog/crud-express-mongodb/

So, I’ve finished this project, but it’s a little different from others - I wasn’t following instructions to the letter, I wanted to make a service that is more “Google-alike”, cannot find better wording. Also, I have two versions - one is written in Node (Express), with the help of MySQL, and the other is PHP/MySQL powered.
I know it needs lots of work (there were some things that I want to change), but for now I’m happy that it (kind of) works. :slight_smile: Also, this was my first PHP app.

Well, first my Node app:

Source
Live project

Now PHP one:

Source
Live

Hi,

I finished the challenge and would welcome any feedback:

Live Project: https://literate-structure.glitch.me
Source: https://github.com/ShalaQweghen/url_shortener_microservice

Thank you

Hello,

Here’s my finished work.
Glitch: https://shibatas-url-shortener-ms.glitch.me/
GitHub: https://github.com/shibatas/url-shortener-ms

This required me to put together everything I’ve learned so far in back-end, so this was quite challenging. Really exciting to finally see it working though. I’ve be very happy if you could try it out and let me know your thoughts!

Hello,

My URL shortener microservice project finished:

Glitch: https://attractive-gun.glitch.me/
GitHub: https://github.com/cortazar11/URL-shortener

That is my first project with full integration node.js and mongo
I have been stucked about the sequence of the commands of express and mongo
in the file server.js until I found the way looking at the video about integration of node, express and mongo in the Mongo University.
By the way very good free course onlines, particularly and very on purpose the MongoDB for
Node.js Developers
.

As usual, very welcome any feedback about my project.

link: https://shorten-my-link.glitch.me/
repo: https://github.com/Dereje1/URL-Shortener

Learnt a whole lot from this project, first time integration of mongoDB in a real project including finding documents and inserting into a database, and then using a remote host (mLab) to access the database locally, and then setting up an environment on the server hosting the app as to not publicly make the database controls accessible, all very valuable lessons.
I have a couple more tweaks I need to do on the regex side, my app can not process “?” in the url query for example, I need to fix that. All in all, learnt a lot of important stuff in this project.

edit, fixed the “?” issue, for those who may run into the same problem, just remember that express uses “?” in routes for queries

1 Like

Hi all,

Project: https://sulky-attraction.glitch.me/
Source: https://github.com/wawraf/url-shortener

This one was really good, i’m waiting for next challenges.
I have used boilerplate default FCC template and try to keep it as simple as possible, so the whole action happens in search.js. Server.js only serve the result.

For me the biggest problem was dealing with mongo async, but callback function from server.js solve the problem.

Best,
Rafal

My URL Shortener API

Project => https://jolav.me/freecodecamp/old/apis/url/url.html
Source Code => https://github.com/jolav/freeCodeCamp/tree/master/old/apis

Finally shipping :ship: the URL Shortener Microservice project. This was the first really involved project. The areas I found challenging were:

  • Setting up env variables to use mLab
  • Modularizing code with async code caused timing issues and unexpected behavior so I put more code all together. I need to learn to modularize better with async calls
  • Regex to handle various valid URL formats

Here is the project and the source code. Any and all feedback welcome. :wave:

Hi! After months struggling with this project, I finally make something that works (I think). It lacks styling, maybe I’ll do that in the future. I would appreciate your comments. If you are so kind go to URLShortenerApp, source code.

Your app hangs out when sent non-valid short url. Probably because you didn’t send a response in case where there is no match for the request.

Thanks a lot for your comment. I will check that.

With which cases do you test it? Which invalid urls hang the app? Please tell me, that would be useful to find where is the bug. Thanks again.