summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-03-15 18:59:38 +0100
committerLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-03-15 18:59:38 +0100
commitcca676dcb3824e9f9ee21ecf0a2cf8c55b0d4ad9 (patch)
tree0aef8a75cbd731eb1637fcac6964b9eea1adcb78 /internal/api
parentbit of experimenting and tidying (diff)
downloadgotosocial-cca676dcb3824e9f9ee21ecf0a2cf8c55b0d4ad9.tar.xz
tests
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/server.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/internal/api/server.go b/internal/api/server.go
index a27178855..ed622210b 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -28,9 +28,9 @@ import (
type Server interface {
AttachHTTPHandler(method string, path string, handler http.HandlerFunc)
- AttachGinHandler(method string, path string, handler gin.HandlerFunc)
- // AttachMiddleware(handler gin.HandlerFunc)
- GetAPIGroup() *gin.RouterGroup
+ AttachGinHandler(method string, path string, handler gin.HandlerFunc)
+ // AttachMiddleware(handler gin.HandlerFunc)
+ GetAPIGroup() *gin.RouterGroup
Start()
Stop()
}
@@ -46,20 +46,22 @@ func (s *server) GetAPIGroup() *gin.RouterGroup {
}
func (s *server) Start() {
- // todo: start gracefully
- s.engine.Run()
+ // todo: start gracefully
+ if err := s.engine.Run(); err != nil {
+ s.logger.Panicf("server error: %s", err)
+ }
}
func (s *server) Stop() {
- // todo: shut down gracefully
+ // todo: shut down gracefully
}
func (s *server) AttachHTTPHandler(method string, path string, handler http.HandlerFunc) {
- s.engine.Handle(method, path, gin.WrapH(handler))
+ s.engine.Handle(method, path, gin.WrapH(handler))
}
func (s *server) AttachGinHandler(method string, path string, handler gin.HandlerFunc) {
- s.engine.Handle(method, path, handler)
+ s.engine.Handle(method, path, handler)
}
func New(config *config.Config, logger *logrus.Logger) Server {