28 lines
609 B
Go
28 lines
609 B
Go
|
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,
|
||
|
}
|
||
|
}
|