Serve json on specific route

Tell us what’s happening:
Describe your issue in detail here.
var express = require(‘express’);
var app = express();
const mySecret = process.env[‘MESSAGE_STYLE’]

// Normal usage
app.use(express.static(__dirname + “/public”));

// Assets at the /public route
app.use("/public", express.static(__dirname + “/public”));
// app.get(’/’, (req, res)=>{
// res.send(‘Hello Express’)
// })

app.get(’/’, (req, res)=>{
res.sendFile(__dirname + “/views/index.html”)

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

here is my code but its not passing the test
Your project link(s)


Your browser information:

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

Challenge: Serve JSON on a Specific Route

Link to the challenge:

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