You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
758 B
26 lines
758 B
package routes
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"teraclone/internal/handler"
|
|
"teraclone/internal/handlers"
|
|
"teraclone/internal/service"
|
|
)
|
|
|
|
func Register(mux *http.ServeMux, appService *service.AppService, apiUpstream string) error {
|
|
return RegisterWithSessionUpstream(mux, appService, apiUpstream, "http://127.0.0.1:8081")
|
|
}
|
|
|
|
func RegisterWithSessionUpstream(mux *http.ServeMux, appService *service.AppService, apiUpstream string, sessionUpstream string) error {
|
|
legacyHandler := handler.NewAppHandler(appService)
|
|
|
|
deviceHandler, err := handlers.NewDeviceHandlerWithSessionUpstream(appService, apiUpstream, sessionUpstream)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
deviceHandler.RegisterRoutes(mux)
|
|
mux.HandleFunc("/health", legacyHandler.HandleHealth)
|
|
return nil
|
|
}
|
|
|