How can we call internal API endpoints within the app in golang (gorilla/mux)?

956 Views Asked by At

I am Using: http://github.com/gorilla/mux (REST API)

basically need to achieve this, but in golang
https://softwareengineering.stackexchange.com/questions/345406/is-it-bad-design-to-internally-call-api-endpoints-from-within-the-api-instance

I tried finding it in the docs but wasn't able to
I presume, it is better to do these calls internally!

Reasons for doing this:

  1. Using existing handler or services would need unnecessary imports & may lead to import cycle errors.

  2. I want to create cronjobs which will periodically call my API endpoints

0

There are 0 best solutions below