Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
26
services/gateway/server/server_http.go
Normal file
26
services/gateway/server/server_http.go
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user