Back End Development and APIs Projects - URL Shortener Microservice

Tell us what’s happening:
Describe your issue in detail here.
What could be the problem because I have done all the best I can but am stuck?
Kindly guide where necessary.
Will be grateful.

Your project link(s)

solution: boilerplate-project-urlshortener - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; TECNO KD7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Mobile Safari/537.36

Challenge: Back End Development and APIs Projects - URL Shortener Microservice

Link to the challenge:

The POST route should be /api/shorturl

You can POST a URL to /api/shorturl and get a JSON response with original_url and short_url properties. Here’s an example: { original_url : 'https://freeCodeCamp.org', short_url : 1}

It ain’t passing what could be the error again.

I can see you have created a new Replit where again you are not using the correct path for the POST. It literally has to be /api/shorturl you do not have a choice in the matter.

The test will hit that endpoint and the form is using api/shorturl for the action attribute.


I have done what you said but nothing still happens

I have tried to change whatever you said but nothing happens even after that.

Tell us what’s happening:
Describe your issue in detail here.

When I copy the code generated by the shorturl, it doesn’t redirect me to the original url
What could be the problem.
Will be grateful.

Your project link(s)

solution: Glitch :・゚✧

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; TECNO KD7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Mobile Safari/537.36

Challenge: Back End Development and APIs Projects - URL Shortener Microservice

Link to the challenge:



That is what it’s now Showing in my console



Am now receiving this in my console please advice

I can’t really do much with that but it looks like a DB error. What is the name of the DB you added to the connection string?

Can you post your connection string without showing the password?

Also, the 8000 error code might be an auth error. Did you provide the correct username and password?


Where are you working on this now and what is the link?

The DB connection string is mongodb+srv://admin:@cluster0.rzk6wtt.mongodb.net/?retryWrites=true&w=majority

The link is https://boilerplate-project-urlshortener-1.emmanuelonyanga.repl.co

Add a DB name to the string. You should be able to pick whatever you like, but don’t use admin as the DB name (might cause issues).

mongodb+srv://username:password@cluster0.rzk6wtt.mongodb.net/DBNameHere?retryWrites=true&w=majority

Did you pick the admin username when you made it? Not sure if that username might be reserved for something (don’t know). Maybe try creating a new user and use a different name.

I used admin as the username when I created it

I have maneuvered a lot but am finally reaching where am meant to be
Here is the link https://boilerplate-project-urlshortener.emmanuelonyanga.repl.co to the project am failing the second last test
Kindly check where the problem could be and advice me on what to do
Thanks in advance



Attached are the console readings
When I copy the shorturl generated to the browser it doesn’t direct me to the original url
What could be the problem.

If I fork your project and use my own DB it passes for me. I don’t ever see the err URLMODELFIND log. Can you please log out the actual error and not just that string?

I would try deleting the collection on Atlas and see if that fixes it.

Let me try deleting the collection on atlas

Did you try logging the error you get?

How do I log out the error?

I cleared the collection in the Atlas and it worked
Thank you

You have access to err so you can log that out.

(err, docs) => {
  if (err) {
    console.error("err URLMODELFIND", err);
  }

Anyway, good to it hear it works for you now.