package main

import (
	"doc-service/common/log"
	"doc-service/routers"
	"github.com/gin-contrib/sessions"
	"github.com/gin-contrib/sessions/cookie"
	"github.com/gin-gonic/gin"
	"os"
	"path"
)

func main() {
	r := gin.Default()

	//日志
	ex, err := os.Executable()
	if nil != err {
		panic(err)
	}
	log.Config(path.Dir(ex) + "/log/doc-server.log")

	store := cookie.NewStore([]byte("secret-doc-service"))
	r.Use(sessions.Sessions("mysession", store))
	r.GET("/test", func(c *gin.Context) {
		c.String(200, "值是%v", "hello word")
	})

	routers.ApiRoutersInit(r)

	r.Run(":9018")
}
