server: start with routing / request handling

This commit is contained in:
Helmut Merz 2023-08-08 19:56:14 +02:00
parent 064fe2c7a6
commit e2afdeb61a

View file

@ -11,9 +11,23 @@ import (
type Cfg struct {
*config.BaseCfg
Port string
Port string
Routes []RouteCfg
}
type RouteCfg struct {
Method string
Path string
Handler Handler
}
type FSCfg struct {
RouteCfg
DocRoot string
}
type Handler func(lib.Context, *gin.Context)
type ServerState struct {
server *http.Server
}
@ -49,3 +63,5 @@ func Serve(ctx lib.Context) {
srv.ListenAndServe()
})
}
// route handlers