FAILING TEST - https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route

Tell us what’s happening:
The test is failing

Your code so far

app.get('/json', function(req, res) {
  res.json({"message": "Hello json"});
})

or
app.get("/json", (req, res) => {
  res.json({
    message: "Hello json"
  });
});

res from my server is:
{"message":"Hello json"}

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 12499.51.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.92 Safari/537.36.

Challenge: apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route

1 Like

Can you provide a link to your Glitch project. Your code appears to be correct, but without seeing the rest of the myApp.js file code, I can not be for certain.

I put in the link and it passed for me. Make sure you’re linking to the live site and not the code (https://freecodecamp-backendnodeserv.glitch.me/)

You should always be using the base url for the solution url. The tests will make requests to the applicable routes based on the base url you provide.

In your case, you should be using https://freecodecamp-backendnodeserv.glitch.me.

1 Like