feat add main with user route

master
fbonhomm 2019-08-24 20:49:10 +02:00
parent f6c66e44aa
commit 66ed6dd35d
1 changed files with 38 additions and 0 deletions

38
main.go Normal file
View File

@ -0,0 +1,38 @@
/**
* Created by fbonhomm
* Email: flo-github@outlook.fr
* Licence: MIT
*/
package main
import (
"github.com/fbonhomm/api-go/source/config"
"github.com/fbonhomm/api-go/source/routers"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"log"
)
// init
func init() {
if err := godotenv.Load(); err != nil {
log.Fatal("No .env file found")
}
}
// main
func main() {
// Initialize Database
db := config.Database()
routerEngine := gin.Default()
routers.User(routerEngine)
// for route := range routers {
// route(routerEngine)
// }
routerEngine.Run()
db.Close()
}