Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package server
import (
"context"
"net/http"
"gateway/handlers"
"fiskerinc.com/modules/httphandlers"
"fiskerinc.com/modules/logger"
httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http"
)
// StartHTTP runs server for websockets and docs
func StartHTTP(ctx context.Context, port string) {
mux := httptrace.NewServeMux()
mux.Handle("/docs/", http.StripPrefix("/docs", handlers.DocsHandler()))
mux.HandleFunc("/session", httphandlers.PanicHandler(handlers.SecureSessionWebsocketHandler))
mux.HandleFunc("/secret_mobile", httphandlers.PanicHandler(handlers.InsecureSessionWebsocketHandler))
logger.Info().Msgf("gateway websockets on http://0.0.0.0%s", port)
logger.Fatal().AnErr("http.ListenAndServe", http.ListenAndServe(port, mux)).Send()
}