I am starting building a api in go(golang), but I have few questions...
So in my main function or init function(because I might use appengine) I was thinking in calling a function which will define all my routes using gorilla mux. Each pice of my application(post, comments etc...) will have its one package with its structures/methods/functions.
Questions:
Because I was thinking in defining the routes in one function, do I need to import in this file all my packages, to send the requests to the right handlers?
What about helper function, for example I would like to set
content type
of the response to beapplication/json
for all the handlers where this is necessary, how I will be able to do that?
I'm not looking for frameworks, just some pointer about how can I overcome those questions in golang way.