Route custom returns a 404

System Information
  • Strapi Version: 4.5.1

hey i would like to create a custom route, to make a count. I created the route, it appears in the permissions. I applied the permissions. but celecie sends me back a 404.

module.exports = {
    routes: [
        {
            method: 'GET',
            path: '/artworks/count',
            handler: 'artwork.count',
        },
    ]
}
'use strict';

/**
 *  artwork controller
 */

const { createCoreController } = require('@strapi/strapi').factories;
const moduleUid = 'api::artwork.artwork'

module.exports = createCoreController(moduleUid, {
    count(ctx) {
        console.log(ctx)
        var { query } = ctx.request
        return strapi.query(moduleUid).count({ where: query });
    }
});


Sans titre

thank you for your help =)

FIXED
Change route file name “count-artworks.js” → “01-count-artworks.js”

had the same issue I had to use localhost:1337/api/route name

bold on the “api” because that was missing and caused me a lot of headaches