Hi,
The last condition is not fulfilled but when I click on the link, it works. Can you please tell me what I have done wrong here.
Implement this route and make sure it works by going to http://localhost:8080/config in the browser

Run your code
Submit task
Help
Status
FAILED
Details

  1. You should create the GET /config route

  2. GET /config route should return valid JSON and status 200

  3. GET /config route should return the CONFIG object in JSON format

server.js

import express from 'express';
import { CONFIG } from './constants.js';

const server = express();

//Here, we'll implement our routes and middleware
const version = (req, res, next) => {
if (!req.query.version || req.query.version !== '0.0.1') {
return res.status(200).json({version: '0.0.1'});
}
next();
}

server.get('/', (req, res) => {
return res.json(CONFIG)
})
server.use(version)

export { server };

Sorry, I said before that when I clicked the link it worked. I get {"version":"0.0.1"} on the webpage. It should actually return CONFIG, right?

    MaleeJ the route implementation is correct, but the server.use(version) and the whole version middleware is not necessary

    Write a Reply...