first commit

This commit is contained in:
2023-10-19 22:47:12 +09:00
commit 7873968e4d
35 changed files with 1710 additions and 0 deletions

32
cmd/main.go Normal file
View File

@ -0,0 +1,32 @@
package main
import (
"log"
"net/http"
configs "studioj/boilerplate_go/configs"
"studioj/boilerplate_go/internal/database"
"studioj/boilerplate_go/internal/helpers"
"studioj/boilerplate_go/internal/routers"
"github.com/apex/gateway"
)
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))
}
}