control: Move serves into a separate components

This commit is contained in:
Tom Wiesing 2022-10-04 11:36:45 +02:00
parent 6f409be8b2
commit 845e927117
No known key found for this signature in database
12 changed files with 210 additions and 127 deletions

View 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)
}