Didn't pass the test because it only lacked 1 space

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

I have followed exactly the task, and there is no error when opening the route. But I have a suspicion because the example has 1 space and mine does not. But I can’t do anything to add 1 more space.

My Code :

var express = require('express');
var app = express();

console.log("Hello World");

absolutePath = __dirname + "/public";

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

app.get("/", function (req, res) {
  absolutePath = __dirname + "/views/index.html";

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

My results:
{"message":"Hello json"}

Example results:
{"message": "Hello json"}

Only 1 space difference!

The Error Message in FreeCodeCamp

solution: boilerplate-express - Replit

My browser information:

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

Challenge: Serve JSON on a Specific Route

Link to the challenge:

Your solution link does not go to your code. If you can copy / paste in your code it would help for getting a solution.

i just add my codes. I hope you can help me. Thank you

Try it with double quotes around message. The JSON syntax is a little different than a Javascript object.

In JSON, string values must be written with double quotes:



In JavaScript, you can write string values with double or single quotes:



the issue is not in the snippet you posted, please show all the code

Your Replit is passing the test for me. Although I’m not sure why you are using setHeader.

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