How to add non /api endpoint using custom endpoints?

As far as I understand, there are two ways to add custom endpoints to Strapi:

  • Either declare them in src/api (endpoints get /api prefix automatically)
  • or create a plugin. (endpoint do not automatically get /api prefix

Problem with first approach, is that I can’t figure it out how to add the endpoint without API prefix, so that it could be used in admin panel by my custom component. (i.e. let’s say I need an endpoint which will be called when clicking a button in admin panel)

is there a way to achieve that without writing a full plugin?