control: Move serves into a separate components
This commit is contained in:
parent
6f409be8b2
commit
845e927117
12 changed files with 210 additions and 127 deletions
18
internal/component/server.go
Normal file
18
internal/component/server.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package component
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/tkw1536/goprogram/stream"
|
||||
)
|
||||
|
||||
// Servable implements a component with a Serve method
|
||||
type Servable interface {
|
||||
Component
|
||||
|
||||
// Routes returns the routes served by this servable
|
||||
Routes() []string
|
||||
|
||||
// Handler returns the handler for the requested route
|
||||
Handler(route string, io stream.IOStream) (http.Handler, error)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue