Tell us what’s happening:
Describe your issue in detail here.
let express = require(“express”);
let app = express();
app.use(express.static(__dirname + “/public”));
app.use("/public", express.static(__dirname + “/public”));
app.get("/", (req, res) => {
res.sendFile(__dirname + “/views/index.html”);
});
app.get("/json", (req, res) => {
res.json({
message: "hello json",
});
});
console.log(“hi”);
module.exports = app;
Your project link(s)
solution: http://localhost:3000
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36
Challenge: Serve JSON on a Specific Route
Link to the challenge: