Basic Node and Express - Serve JSON on a Specific Route

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

I have this code in IDE.

app.use("/public", express.static(__dirname+"/public"));

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

app.get("/", (request, response) => {
  let absolutePath = __dirname + "/views/index.html";

but the following test fails… and says that

    • The endpoint /json should serve the json object {"message": "Hello json"}*

Where am I going wrong?
Your project link(s)

solution: boilerplate-express - Node.js Repl - Replit

Your browser information:

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

Challenge: Basic Node and Express - Serve JSON on a Specific Route

Link to the challenge:

When I submit your live app url it passes. You may have to make sure you app is awake before submitting.

1 Like

It has been submitted. Thank You!
It was a silly overlook sorry.

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