Skip to content

Commit

Permalink
Routing unification #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelewski committed Dec 9, 2024
1 parent eabc3b5 commit d77bee1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions quesma/frontend_connectors/basic_http_frontend_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func (router *HTTPRouter) Multiplexer() *http.ServeMux {
return router.mux
}

func (router *HTTPRouter) Register(pattern string, predicate quesma_api.RequestMatcher, handler quesma_api.Handler) {
panic("not implemented")
}

type BasicHTTPFrontendConnector struct {
listener *http.Server
router quesma_api.Router
Expand Down
21 changes: 21 additions & 0 deletions quesma/v2/core/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,24 @@ func (p *predicateAlways) Matches(req *Request) MatchResult {
func Always() RequestMatcher {
return &predicateAlways{}
}

func (p *PathRouter) AddRoute(path string, handler HTTPFrontendHandler) {
// TODO: it seems that we can adapt this to register call
// p.Register(path, Always(), handler)
panic("not implemented")
}
func (p *PathRouter) AddFallbackHandler(handler HTTPFrontendHandler) {
panic("not implemented")
}
func (p *PathRouter) GetFallbackHandler() HTTPFrontendHandler {
panic("not implemented")
}
func (p *PathRouter) GetHandlers() map[string]HandlersPipe {
panic("not implemented")
}
func SetHandlers(handlers map[string]HandlersPipe) {
panic("not implemented")
}
func Multiplexer() *http.ServeMux {
panic("not implemented")
}
1 change: 1 addition & 0 deletions quesma/v2/core/quesma_apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Router interface {
GetHandlers() map[string]HandlersPipe
SetHandlers(handlers map[string]HandlersPipe)
Multiplexer() *http.ServeMux
Register(pattern string, predicate RequestMatcher, handler Handler)
}

type FrontendConnector interface {
Expand Down

0 comments on commit d77bee1

Please sign in to comment.