cslms-api/cmd/main.go

46 lines
798 B
Go
Raw Normal View History

2023-12-27 17:31:49 +09:00
package main
import (
configs "learnsteam/cslms-api/configs"
_ "learnsteam/cslms-api/docs"
"learnsteam/cslms-api/internal/database"
"learnsteam/cslms-api/internal/helpers"
"learnsteam/cslms-api/internal/routers"
"log"
"net/http"
"github.com/apex/gateway"
)
// @title Learnsteam CodingSchool API
// @version 1.0
// @description Learnsteam CodingSchool API
// @contact.name Jay Sheen
// @contact.email sheen@jongyeob.com
// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization
func main() {
Init()
Run()
}
func Init() {
database.Init()
routers.Init()
database.AutoMigrate()
}
func Run() {
if helpers.InLambda() {
log.Fatal(gateway.ListenAndServe(configs.PORT, routers.Router))
} else {
log.Fatal(http.ListenAndServe(configs.PORT, routers.Router))
}
}