Prioritize custom route

System Information
  • Strapi Version: 4.8.2
  • Operating System: Windows
  • Database: Postgres
  • Node Version: 16.19.2
  • NPM Version: 8.19.3
  • Yarn Version: -

Hello! I am trying to create custom route in Strapi V4. I have content-type called: ‘active-users’. Strapi creates default controllers (findOne, update, find… etc.)
When I use route GET /api/active-users/1 - I get output with active user with id field equals to 1 as intended. I created custom.js file with route /api/active-users/online like this:

module.exports = {
  routes: [
    {
      method: "GET",
      path: "/active-users/online",
      handler: "active-user.getOnlineUsers"
    }
  ]
};

When I am calling this custom route, Strapi thinks that ‘online’ part is a parameter for findOne controller property (/api/active-users/:id) and because of it. Is there a way to prioritize declared custom route? Maybe something in config parameter have to be set to make Strapi call this route? Thanks in advance!

I’ve also tried moving custom routes above findOne route like this, but it did not help

module.exports = {
  routes: [
    {
      method: "POST",
      path: "/active-users",
      handler: "active-user.create",
      config: {
        policies: []
      }
    },
    {
      method: "POST",
      path: "/active-users/status",
      handler: "active-user.changeOnlineStatus",
      config: {
        policies: []
      }
    },
    {
      method: "GET",
      path: "/active-users/online",
      handler: "active-user.getOnlineUsers",
      config: {
        policies: []
      }
    },
    {
      method: "GET",
      path: "/active-users/:id",
      handler: "active-user.findOne",
      config: {
        policies: []
      }
    }
  ]
};