package main

import (
	"fmt"
	"log"
	"youngee_b_api/config"
	_ "youngee_b_api/docs"
	"youngee_b_api/route"
	"youngee_b_api/service"

	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()
	route.InitRoute(r)
	config := config.Init()
	mailConfig := "./config/mail.json"
	service.SMTPMailServiceIstance.Init(mailConfig)
	addr := fmt.Sprintf("%v:%v", config.Host, config.Port)
	err := service.AutoTask()
	if err != nil {
		log.Println("service AutoTask error:", err)
	}
	r.Run(addr) // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
