How to run a handlerFunc and fileServer on Same Path?

I have function named requestHandler() which helps in implementing the Smart-HTTP to the git-server. When I see in my browser with the URL it is showing “Not Found”. So I thought of adding a Fileserver using another handle its Working but with different URL paths

http.Handle("/api/", http.StripPrefix("/api", requestHandler()))
http.Handle("/", http.FileServer(http.Dir(BasePath)))

But I want both of them working with the same URL/Path. Is there any way to do that?

Hi Vamsheeth. You should use mux to route the request to handle.

Try to use a mux as gollira mux Gorilla, the golang web toolkit

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.