How do I output this

Tell us what’s happening:
please how do I output a query in this format

{ name: 'firstname lastname'}

thanks in advance :smiling_face_with_three_hearts:

Your project link(s)

solution: https://replit.com/@yunishello/boilerplate-express

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 OPR/78.0.4093.231

Challenge: Get Query Parameter Input from the Client

Link to the challenge:

From the description:

Build an API endpoint, mounted at GET /name . Respond with a JSON document, taking the structure { name: 'firstname lastname'} . The first and last name parameters should be encoded in a query string e.g. ?first=firstname&last=lastname .

So the { name: 'firstname lastname'} is part of the response. It is what you are sending back. The way you are inputting it, is by including the ?first=firstname&last=lastname query in the url.

Does that makes sense?

1 Like

sir it was expected to output the query string in such a format

OK, I’m still not sure what you are asking.

If I try to use your solution url (https://replit.com/@yunishello/boilerplate-express) to pass the test, it fails.

That is because that is not a url to the server, but is a url to your replit. You can get the url to the server by selecting the Output and then opening up a url to the server, by pressing here:

That should open up a new tab/window with a url pointing to your server. If I take that url and plug it into the FCC test, as the solution, then the tests pass for me.

Does that makes sense?

1 Like

Am sorry I did mention earlier, I’ve gotten the solution already, thanks for your time :smiling_face_with_three_hearts:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.