I have created a custom controller with the following configurations:
This is running on local docker containers. I have added other custom endpoints in similar manner but just recently when i added another endpoint, i got stuck with this issue.
The below endpoint is showing under on the Roles & Permissions in the Strapi dashboard
Controller.js
module.exports = {
async stock(ctx) {
console.log("stocks called ==")
return { message: "success" }
}
};
Routes.json
{
"method": "GET",
"path": "/materials/stock",
"handler": "material.stock",
"config": {
"policies": []
}
}
Permission has been added for the authenticated user, but still when calling this endpoint http://localhost:80/materials/stock it returns with { "statusCode": 404, "error": "Not Found", "message": "Not Found" }
Solution:
Change the method to POST. Using the method as GET doesn't seems to be working. Some kind of bug with Strapi or probably something wrong with my configuration.