I am trying to create a route on Strapi in order to get comments from one article.
The solution proposes to create a route in an existing file in routes folder itself in api folder. I am thinking I made a mistake with syntax but even with the help in the documentation. I don't find the solution.
'use strict';
/**
* post router.
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::post.post', {
only: ['find'],
config: {
find: {
auth: false,
policies: [],
middlewares: [],
}
},
method: "GET",
path: "/posts/:id/comments",
handler: "posts.comments"
});
Here is the datas from API we can see in my article :
Thank you very much for your help.
