Last active
December 12, 2020 05:10
-
-
Save krittawatcode/4bb7436dd34c30c08ce7f6de2fbcc753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
_ "github.com/go-sql-driver/mysql" | |
"github.com/jinzhu/gorm" | |
"github.com/krittawatcode/go-todo-clean-arch/databases" | |
"github.com/krittawatcode/go-todo-clean-arch/deliveries/routes" | |
"github.com/krittawatcode/go-todo-clean-arch/models" | |
) | |
var err error | |
func main() { | |
databases.DB, err = gorm.Open("mysql", databases.DbURL(databases.BuildDBConfig())) | |
if err != nil { | |
fmt.Println("statuse: ", err) | |
} | |
defer databases.DB.Close() | |
// run the migrations: todo struct | |
databases.DB.AutoMigrate(&models.Todo{}) | |
//setup routes | |
r := routes.SetupRouter() | |
// running | |
r.Run(":8080") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment