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!