-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
47 lines (36 loc) · 914 Bytes
/
Copy pathmain.go
File metadata and controls
47 lines (36 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"devdesk/config"
"devdesk/controllers"
"devdesk/db"
"log"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
var conf *config.Config
func initialize() {
var err error
conf, err = config.LoadConfig("config/conf.yaml")
if err != nil {
log.Fatal("Config dosyaları (conf.yaml) yüklenemedi: ", err)
}
config.InitLogger(conf.Server.ActiveLevel)
config.Log.Sync()
db.Connect(conf.Database, conf.Server.EnvPath)
db.SyncDataBase()
}
func main() {
initialize()
r := gin.Default()
corsConfig := cors.DefaultConfig()
corsConfig.AllowAllOrigins = true
r.Use(cors.New(corsConfig))
//' User ayarları
r.POST("/signup", controllers.Signup)
r.POST("/login", controllers.Login)
r.GET("/users", controllers.GetUsers)
r.PATCH("/users/:id", controllers.UserUpdateReq)
//' Event ayarları
r.POST("/event", controllers.CreateEventRequest)
r.Run(conf.Server.Port)
}