You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
766 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. package app
  2. import (
  3. "fmt"
  4. "git.aiterp.net/lucifer/new-server/app/api"
  5. "git.aiterp.net/lucifer/new-server/app/config"
  6. "git.aiterp.net/lucifer/new-server/app/services"
  7. "github.com/gin-gonic/gin"
  8. "log"
  9. )
  10. func StartServer() {
  11. services.StartEventHandler()
  12. services.StartPublisher()
  13. services.ConnectToBridges()
  14. services.CheckNewDevices()
  15. gin.SetMode(gin.ReleaseMode)
  16. ginny := gin.New()
  17. apiGin := ginny.Group("/api")
  18. api.Bridges(apiGin.Group("/bridges"))
  19. api.Devices(apiGin.Group("/devices"))
  20. api.ColorPresets(apiGin.Group("/color-presets"))
  21. api.DriverKinds(apiGin.Group("/driver-kinds"))
  22. api.Events(apiGin.Group("/events"))
  23. api.EventHandlers(apiGin.Group("/event-handlers"))
  24. log.Fatal(ginny.Run(fmt.Sprintf("0.0.0.0:%d", config.ServerPort())))
  25. }