Best way to create handler for router with testability in mind

Written by
reddit
Link to Post

https://www.reddit.com/r/golang/comments/bp1jzb/best_way_to_create_handler_for_router_with/ by 

I am using a chi to do my routing for me, and i have very basic handler that would GET a value from the db. My db statements occur in my handler. I am wondering if this is too tightly coupled and testing it would be a problem. If so what is the best way to 1. test a handler 2. stub out the sql portion of the handler

Any help would be greatly appreciated thanks.

submitted by /u/Gbyrd99
[link] [comments]

Article Tags:
· ·
Article Categories:
reddit

Leave a Reply