46 lines
798 B
Go
46 lines
798 B
Go
|
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))
|
||
|
}
|
||
|
}
|