main.go 714 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package main
  2. import (
  3. "log"
  4. "strconv"
  5. "time"
  6. _ "github.com/lib/pq"
  7. "git.dmitriygnatenko.ru/dima/homethings/internal/fiber"
  8. sp "git.dmitriygnatenko.ru/dima/homethings/internal/service_provider"
  9. )
  10. // @title Homethings API
  11. // @version 1.0
  12. // @securitydefinitions.apikey APIKey
  13. // @in header
  14. // @name Authorization
  15. func main() {
  16. serviceProvider, err := sp.Init()
  17. if err != nil {
  18. log.Fatal(err)
  19. }
  20. fiberApp, err := fiber.Init(serviceProvider)
  21. if err != nil {
  22. log.Fatal(err)
  23. }
  24. port := strconv.FormatUint(uint64(serviceProvider.ConfigService().AppPort()), 10)
  25. if err = fiberApp.Listen(":" + port); err != nil {
  26. log.Fatal(err)
  27. }
  28. }
  29. func init() {
  30. time.Local = time.UTC
  31. }