Custom route always 404

<@604068445499162664> I have found the solution, which is a weird behaviour:

The routes seem to be loaded for each file located in /routes for a particular object, in an alphabetical order. My order is:

/routes
    command.ts
    custom-routes.ts

So I guess the core routes are first loaded, and then my custom routes defined in custom-routes.ts. I don’t understand why, but my GET route defined in custom-routes.ts is replaced by the findOne route.

When I change the order of the files to be something like this:

/routes
    a-custom-routes.ts
    command.ts

Then my custom route is recognized and works. I can’t explain why this is behaving like this, but here it is. So it seems that the general rule would be to always have one’s custom routes file before the core file ones.

1 Like