Hello,
I am trying to set the URL that shows the comments I posted for an article (post).
I am using this URL to see the article in my API with the comments related: http://localhost:1337/api/posts/1?populate=*.
While when I use this URL http://localhost:1337/api/posts/1/comments?populate=*, it shows :
This is the code I wrote in the file post.js in the routes folder :
'use strict';
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
});
Where is my mistake ?