quite some time now, have used Go Chi, and MySQL, everything was in main.go and now that I'm done with first endpoint of the API, before moving onto next, I'd like modularise it and have common functions, SQL queries in their seperate go files, so my question is how do I do that?
First > main.go, and endpoint codes in an endpoints directory, and other functions maybe in "utils" or something, leaving only main.go in project root directory.. how about something like this?
Also this is probably going to remain private repo so I'm not sure how would I access "endpoints", "utils" functions in maybe main.go file or from one package's function to another
never call your package "utils"
not even for internal only use within the library?
Alright just as an example I mentioned, so what do you think?
Обсуждают сегодня