| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package main
- import (
- "crawler/config"
- "crawler/middleware"
- "crawler/route"
- "crawler/service"
- "crawler/utility"
- "github.com/gin-gonic/gin"
- "log"
- "net/http"
- "time"
- )
- /*
- @author 김국현
- @date 2022.12.25
- */
- func main() {
- utility.SetEnviron()
- utility.SetDebug()
- // MySQL DB 연결
- db := new(service.DB)
- service.DB_MOVIEW = db.Connection(config.DB_MOVIEW)
- service.DB_CRAWLER = db.Connection(config.DB_CRAWLER)
- service.DB_PLAYR = db.Connection(config.DB_PLAYR)
- app := gin.Default()
- app.Use(middleware.Access()) // 접속기록
- app.Use(middleware.GinBodyResponse()) // request 요청 로그
- // Routing
- route.SetRoute(app)
- var port = config.Env.APP.Port
- server := &http.Server{
- Addr: ":" + port,
- Handler: app,
- ReadTimeout: time.Duration(config.Env.APP.ReadTimeout) * time.Second,
- WriteTimeout: time.Duration(config.Env.APP.WriteTimeout) * time.Second,
- MaxHeaderBytes: config.Env.APP.MaxHeaderBytes << 20,
- }
- log.Println("Server was started successfully !!")
- log.Println(server.ListenAndServe())
- }
|