I’m building a simple REST API in Go and have a question.
I have a HandleFunc
that looks like this:
http.HandleFunc("/users", userHandler)
and that points to the user handler. What I want is another HandleFunc
at /users that lets me load handlers for sub-URLs such as /users/login
and /users/logout
so that I don’t have hundreds of HandleFunc
in my main()
function.
I’m fairly new to Go so it is quite likely I am missing something obvious so if you could point me in the right direction I would appreciate it.