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";
res.sendFile(absolutePath);
});
app.get("/json", (req, res) => {
res.json({
"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: