Plugin to intercept all requests

I am looking to create a plugin to intercept all requests to the strapi api, i want to get the parameter ID and alter how the api searches the db. For example, if i make a call to my api at: /api/my-endpoint/123, i want a to build a plugin to get the ID parameter(123) and return back db results for a slug in the db instead of the default id field.

I am testing this currently with the source code of one of the strapi marketplace plugins(transformer). Is this possible or am i looking the wrong place to perform this action. I thought i could maybe do this with just a global middleware but i couldnt find any information on getting the request params and then overriding the findOne() method.

Any help would be appreciated.