1
0
Fork 0
httpserver/site.go

26 Zeilen
724 B
Go

package httpserver
import "github.com/gin-gonic/gin"
// Site is an Interface to abstract the modularized group of pages.
// The Middleware must be able to detect multiple calls by itself. Deduplication is not performed.
type Site interface {
Setup(SiteConfig) error
Init(*gin.RouterGroup)
Teardown()
Defaults() SiteConfig
}
// SiteConfig is an interface for configitems of the site. The methods return the required items for the server
type SiteConfig map[string]interface{}
// Domain gives an easier access to the domain value
func (sc SiteConfig) Domain() string {
return sc["domain"].(string)
}
// Path gives an easier access to the path value
func (sc SiteConfig) Path() string {
return sc["path"].(string)
}