Tests fail no matter what I do | Please help

I was working on my project and checking it with the postman. According to the postman and my tries, the code works just as intended. Yet, all the tests fail.
Your code so far

Here is a link to my live glitch : https://microservices-konevtwo.glitch.me
Here is a link to my git repo: https://github.com/VasylKB/microservices-konevtwo.git

User Agent is: Chrome/83.0.4103.97.

Challenge: Timestamp Microservice

Link to the challenge:

So, I was able to resolve the matter. The issue was that requests from postman looked different than those from freecodecamp.
This is what I was trying to do:

let date = req.query.date_string;

This is what I did in order to pass tests:

let input = req.params.date_string;

Hello @vasylk,

Just to clarify the reason you were having this problem: there is a difference between req.query and req.params.

This post does a pretty good job explaining it, I think.
Basically, they both come from the URL, but they are used differently.

URL: www.example.com/songs/:songId
How to access: req.params.songId
req.params.songId = 48819

URL: www.example.com/songs?
How to access: req.query
Example: www.example.com/songs?song=i_want_to_break_free&artist=queen
req.query = { song: 'i_want_to_break_free', artist: 'queen' }

Notice how with PARAMS, that part of the path (:songId) will always be called req.params.songId. With QUERY you can set any key with a value, and that will be added to the query object.

I hope this helps you avoid future problems.

1 Like

Now, I see that the User Story clearly suggests using params

The API endpoint is GET [project_url]/api/timestamp/:date_string?

My bad. It is good that I learn about it now and not later and I would be more careful in the future.
Thanks for your explanation. It helps.