I've started to play with middlewares, it's great !
Here's an example of how I can inject a middleware when calling endpoints /api/playlists or /api/playlists/:id (I edited the file src/api/playlist/routes/playlist.js).
module.exports = createCoreRouter('api::playlist.playlist', {
config: {
find: {
middlewares: ['api::playlist.playlist.find']
},
findOne: {
middlewares: ['api::playlist.playlist.find-one']
},
},
})
Of course, I also created my middlewares in src/api/playlist/middlewares/find.js and src/api/playlist/middlewares/find-one.js)
But know, I want to add another middleware to update the responses returned by the API when calling /api/users or /api/users/:id.
Since there is no directory src/api/user in the filetree, how should I register a middleware for this ?
Thanks