mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-05-31 22:58:32 +00:00
allow attaching middleware to server
This commit is contained in:
parent
80873ed65e
commit
f5b62e62d6
|
@ -32,7 +32,7 @@ import (
|
|||
|
||||
type Server interface {
|
||||
AttachHandler(method string, path string, handler gin.HandlerFunc)
|
||||
// AttachMiddleware(handler gin.HandlerFunc)
|
||||
AttachMiddleware(handler gin.HandlerFunc)
|
||||
GetAPIGroup() *gin.RouterGroup
|
||||
Start()
|
||||
Stop()
|
||||
|
@ -71,6 +71,10 @@ func (s *server) AttachHandler(method string, path string, handler gin.HandlerFu
|
|||
}
|
||||
}
|
||||
|
||||
func (s *server) AttachMiddleware(middleware gin.HandlerFunc) {
|
||||
s.engine.Use(middleware)
|
||||
}
|
||||
|
||||
func New(config *config.Config, logger *logrus.Logger) Server {
|
||||
engine := gin.New()
|
||||
store := memstore.NewStore([]byte("authentication-key"), []byte("encryption-keyencryption-key----"))
|
||||
|
|
Loading…
Reference in a new issue