Tell us what’s happening:
i don’t know why it not pass. Where is my fault, help me
###Your project link(s)
solution: https://f6a3b591-b5cc-430c-b4a7-104f3fb1bc2a-00-32b2iv065hys9.pike.replit.dev
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Challenge Information:
Basic Node and Express - Chain Middleware to Create a Time Server
a2937
July 22, 2025, 4:17pm
2
You provided a link to your running application. Not your code. It’s kinda hard to debug without it.
Let’s try to figure it out though. What messages did the challenge tell you when you tried to submit?
1 Like
this is my code, sorry i forgot, it’s covered by the comment
const bodyParser = require('body-parser');
let express = require('express');
let app = express();
require('dotenv').config();
function simpleLogger(req, res, next){
const method = req.method;
const path = req.path;
const ip = req.ip;
console.log(`${method} ${path} - ${ip}`);
next();
}
app.use(simpleLogger);
app.use(bodyParser.urlencoded({extended: false}))
app.post('/create', (req, res) => {
console.log(req.body);
res.send('ok');
})
app.get('/:word/echo/', (req, res) =>{
const word = req.params.word;
res.json({echo: word})
})
app.get('/name', (req, res) =>{
const first = req.query.first;
const last = req.query.last;
res.json({name: `${first} ${last}`});
});
// this is my problem/////////////////////////
app.get("/now", (req, res, next) => {
req.time = new Date().toString();
next();
}, (req, res) => {
res.json({time: req.time});
})
/////////////////////////////////////////////
I’ve edited your post to improve the readability of the code. 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 (').
1 Like