linstrom/server/server.go

28 lines
609 B
Go
Raw Normal View History

2024-05-31 09:54:39 +00:00
package server
import (
"net/http"
"gitlab.com/mstarongitlab/linstrom/server/middlewares"
"gitlab.com/mstarongitlab/linstrom/storage"
)
type Server struct {
handler http.Handler
}
func NewServer(store *storage.Storage) *Server {
handler := http.NewServeMux()
handler.HandleFunc("/.well-known/webfinger", webfingerHandler)
// handler.Handle("/api/", http.StripPrefix("/ap", buildApiRouter()))
withMiddlewares := middlewares.ChainMiddlewares(
handler,
middlewares.InjectLogrusMiddleware,
middlewares.InjectStorageMiddlewareBuilder(store),
)
return &Server{
handler: withMiddlewares,
}
}