handler 경로 변경

This commit is contained in:
2023-06-10 16:27:46 +09:00
parent 18e7ee0afa
commit 1d525eb7cf

View File

@ -44,15 +44,18 @@ func NewHoustonHandler() HoustonServerWithHandler {
func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string) error {
logger.Println("houstonHandler registed")
serveMux.Handle("/"+path.Join(prefix, "houston"), h)
if len(prefix) > 0 {
prefix = "/" + prefix
}
serveMux.Handle(prefix, h)
fsx := http.FileServer(http.Dir("deploys"))
serveMux.Handle(fmt.Sprintf("/%s/deploys/", prefix), http.StripPrefix(fmt.Sprintf("/%s/deploys/", prefix), fsx))
serveMux.Handle(fmt.Sprintf("%s/deploys/", prefix), http.StripPrefix(fmt.Sprintf("%s/deploys/", prefix), fsx))
ufsx := http.FileServer(http.Dir("downloads"))
serveMux.Handle(fmt.Sprintf("/%s/houston/downloads/", prefix), http.StripPrefix(fmt.Sprintf("/%s/houston/downloads/", prefix), ufsx))
serveMux.Handle(fmt.Sprintf("%s/downloads/", prefix), http.StripPrefix(fmt.Sprintf("%s/downloads/", prefix), ufsx))
serveMux.HandleFunc("/"+path.Join(prefix, "upload"), func(w http.ResponseWriter, r *http.Request) {
serveMux.HandleFunc(fmt.Sprintf("%s/upload", prefix), func(w http.ResponseWriter, r *http.Request) {
defer func() {
s := recover()
if s != nil {