Serve JSON on a Specific Route bad test

Tell us what’s happening:
Describe your issue in detail here.
I’m trying to solve the question { Serve JSON on a Specific Route } from Back End Development and APIs. Apparently, my answer satisfies all parameters but the test says " The endpoint /json should serve the json object {"message": "Hello json"} "

Challange:
Serve the object {"message": "Hello json"} as a response, in JSON format, to GET requests to the /json route. Then point your browser to your-app-url/json , you should see the message on the screen.

My code:
app.get("/json", (req, res) => {
res.json(
{ message: ‘Hello json’ }
);
});

Your project link(s)

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

Your browser information:

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

Challenge: Serve JSON on a Specific Route

Link to the challenge:

You are supposed to return an object, not an array. You have json as an array with an object inside.

Thank you very much. I just removed the and worked.

1 Like

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