Skip to content

Commit

Permalink
feat: added GetRouter and Handler methods to Module interface and imp…
Browse files Browse the repository at this point in the history
…lementation
  • Loading branch information
ralvarezdev committed Jan 25, 2025
1 parent 696c28e commit 59b12d1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions http/factory/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package factory

import (
gonethttproute "github.com/ralvarezdev/go-net/http/route"
"net/http"
)

type (
// ModuleWrapper is the interface for the route module
ModuleWrapper interface {
Create(baseRouter gonethttproute.RouterWrapper, path string) error
GetRouter() gonethttproute.RouterWrapper
Handler() http.Handler
}

// Module is the struct for the route module
Expand Down Expand Up @@ -37,5 +40,14 @@ func (m *Module) Create(
path string,
) error {
return m.Controller.CreateRouter(baseRouter, path)
}

// GetRouter is a function that returns the router
func (m *Module) GetRouter() gonethttproute.RouterWrapper {
return m.Controller.GetRouter()
}

// Handler is a function that returns the handler
func (m *Module) Handler() http.Handler {
return m.Controller.Handler()
}

0 comments on commit 59b12d1

Please sign in to comment.