39 lines
662 B
Go
39 lines
662 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"git.trj.tw/golang/go-gallery/models"
|
|
"git.trj.tw/golang/go-gallery/modules/config"
|
|
"git.trj.tw/golang/go-gallery/modules/memstore"
|
|
"git.trj.tw/golang/go-gallery/modules/options"
|
|
"git.trj.tw/golang/go-gallery/routers/routes"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
var server *gin.Engine
|
|
|
|
func init() {
|
|
options.RegFlag()
|
|
}
|
|
|
|
func main() {
|
|
err := memstore.InitClient()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
err = config.LoadConfig()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
server = routes.NewServ()
|
|
x, err := models.NewDB()
|
|
defer x.Close()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
routes.SetDefaultRoutes(server)
|
|
|
|
server.Run(":10230")
|
|
}
|