forked from pclubiitk/puppy-love
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (33 loc) · 842 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
41
42
package main
import (
"fmt"
"os"
"github.com/pclubiitk/puppy-love/config"
"github.com/pclubiitk/puppy-love/db"
"github.com/pclubiitk/puppy-love/router"
"github.com/pclubiitk/puppy-love/utils"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
)
func executeFirst(c *gin.Context) {
// fmt.Println(string(ctx.Path()[:]))
// ctx.Next()
}
func main() {
config.CfgInit()
mongoDb, error := db.MongoConnect()
if error != nil {
fmt.Print("[Error] Could not connect to MongoDB")
fmt.Print("[Error] " + config.CfgMgoUrl)
fmt.Print(os.Environ())
os.Exit(1)
}
utils.Randinit()
// set up session db
store := sessions.NewCookieStore([]byte(config.CfgAdminPass))
// iris.Config.Gzip = true
r := gin.Default()
r.Use(sessions.Sessions("mysession", store))
router.PuppyRoute(r, mongoDb)
r.Run(config.CfgAddr)
}