Closed agil3st closed 1 year ago
I think i misunderstand how to use this plugin. I already modified the blog
controller and did not set a custom route. it should be correct like this without using this plugin
// src/api/blog/controllers/blog.js
module.exports = createCoreController('api::blog.blog', ({ strapi }) => ({
async findBySlug(ctx) {
const { slug } = ctx.params;
const query = {
filters: { slug },
...ctx.query,
populate: "*",
};
const blog = await strapi.entityService.findMany(
"api::blog.blog",
query
);
const { meta } = await super.find(ctx);
const schema = strapi.getModel("api::blog.blog");
const sanitizedEntity = await sanitize.contentAPI.output(blog, schema);
return this.transformResponse(sanitizedEntity[0], meta);
},
}));
// src/api/blog/routes/01-custom-blog.js
module.exports = {
routes: [
{
method: 'GET',
path: '/blogs/find-by-slug/:slug',
handler: 'api::blog.blog.findBySlug',
},
]
};
Slugify config on multiple table not generating findBySlug on Settings. I already did
npm run build
but still not generatingfindBySlug
It is okay on
product
permission but i can't findfindBySlug
inblog
permission settings