-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
54 lines (40 loc) · 1.39 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"flag"
"log"
"github.com/observerly/nocturnal/internal/router"
"github.com/observerly/nocturnal/pkg/moon"
"github.com/observerly/nocturnal/pkg/sun"
"github.com/observerly/nocturnal/pkg/transit"
"github.com/observerly/nocturnal/pkg/twilight"
)
var (
port = flag.String("port", ":8103", "Port to listen on. Default is 8103.")
)
func main() {
// Parse command-line flags
flag.Parse()
r := router.SetupRouter()
// Moon (Lunar) Properties API version 1 (deprecated):
r.GET("/api/v1/moon", moon.GetMoonDeprecatedV1)
r.GET("/api/v1/lunar", moon.GetMoonDeprecatedV1)
// Moon (Lunar) Properties API version 2 (^14.02.2023):
r.GET("/api/v2/moon", moon.GetMoon)
r.GET("/api/v2/lunar", moon.GetMoon)
// Sun (Solar) Properties API
r.GET("/api/v1/sun", sun.GetSunDeprecatedV1)
r.GET("/api/v1/solar", sun.GetSunDeprecatedV1)
// Sun (Solar) Properties API version 2 (^14.02.2023):
r.GET("/api/v2/sun", sun.GetSun)
r.GET("/api/v2/solar", sun.GetSun)
// Transit Properties API
r.GET("/api/v1/transit", transit.GetTransitDeprecatedV1)
// Transit Properties API version 2 (^02.03.2023):
r.GET("/api/v2/transit", transit.GetTransit)
// Twilight (Crepusculum) Properties API
r.GET("/api/v1/twilight", twilight.GetTwilight)
// Twilight (Crepusculum) Properties API version 2 (^02.03.2023):
r.GET("/api/v2/twilight", twilight.GetTwilight)
// Listen on port
log.Fatal(r.Run(*port))
}