I'm currently working on a web application and implementing a user authentication system using middleware in Go. I'm wondering what the best way is to inject a repository or service in a middleware for user authentication.
The reason I want to do this is because I want to use a repository's method for every user authentication. However, I'm not sure if it's clean to inject a repository or service in a middleware.
Does anyone have any suggestions or best practices for how to do this in a clean and maintainable way?
I have read this question on Stackoverflow but it seems to be related to C# and not necessarily a design issue.
Thanks in advance for your insights.
Aucun commentaire:
Enregistrer un commentaire