Basic Node and Express - Chain Middleware to Create a Time Server

Tell us what’s happening:

I am stuck on this step. I have looked into several resources and not able to find the error.

###Your project link(s)

let express = require('express');
let app = express();
require('dotenv').config();


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

app.use("/", (req, res, next) => {
    console.log(`${req.method} ${req.path} - ${req.ip}`);
    next();
})

app.get("/now", (req, res, next) => {
    req.time = new Date().toString();
    next();
}, (req, res) => {
    res.send(req.time);
})


app.get("/json", (req, res) => {
    if (process.env.MESSAGE_STYLE === "uppercase") {
        res.json({"message": "Hello json".toUpperCase()})
    } else {
        res.json({"message": "Hello json"});
    }
})
































 module.exports = app;

solution: https://3000-freecodecam-boilerplate-8kewxaqal7s.ws-us116.gitpod.io

Your browser information:

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

Challenge Information:

Basic Node and Express - Chain Middleware to Create a Time Server

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

In the handler, respond with a JSON object, taking the structure {time: req.time} .

You are not responding with a JSON object, or I don’t see it, where is that code?

That worked. Thank you!