-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
40 lines (35 loc) · 1012 Bytes
/
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
package main
import (
"os"
"time"
"github.com/gin-gonic/gin"
_ "github.com/joho/godotenv/autoload"
"github.com/mshafiee/swephgo"
)
var (
city = os.Getenv("CITY")
houseSystem = os.Getenv("HOUSE_SYSTEM")
loc string
location *time.Location
swisspath = os.Getenv("SWISSPATH")
)
func init() {
location, _ = time.LoadLocation(city)
swephgo.SetEphePath([]byte(swisspath))
}
func main() {
defer swephgo.Close()
//
router := gin.Default()
router.SetTrustedProxies(nil)
// Process the templates at the start so that they don't have to be loaded
// from the disk again. This makes serving HTML pages very fast.
router.LoadHTMLGlob("templates/*")
router.StaticFile("/favicon.ico", "./static/favicon.ico") // some clients don't read webmanifest
router.StaticFile("/astrochart.min.js", "./static/astrochart.min.js")
router.GET("/", printHoroscope)
router.GET("/radix", printRadix)
router.GET("/transit", printTransit)
router.GET("/cycles", printCycles)
router.Run(":8080")
}