Why isn't this app.route working?

For the issue-tracking project, I’m trying to put my app.route(’/api/issues/:project’) inside the MongoClient.connect callback (to further making changes on db on certain route methods), but the server responds with 404 error. I tried using it outside the callback, in the plain api.js file, and it works just fine.

I’m talking about this part of api.js

MongoClient.connect(CONNECTION_STRING, function(err, db) {
err?console.log(err):console.log("connected")
  app.route('/api/issues/:project')
  
    .get(function (req, res){
    console.log("hi")
      var project = req.params.project;
      res.send("hi")
    })
    
    .post(function (req, res){
      var project = req.params.project;
    res.send("hi")
    })
    
    .put(function (req, res){
      var project = req.params.project;
      
    })
    
    .delete(function (req, res){
      var project = req.params.project;
      
    });
});```

any help would be appreciated :)

Hello!

Are there any errors logged to the console when you perform the request? One possibility is that before the route gets defined an error is thrown that prevents the creation of these routes.