-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (28 loc) · 1.01 KB
/
main.go
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
package main
import (
"fmt"
"github.com/beingnoble03/octern-main/controllers"
"github.com/beingnoble03/octern-main/handlers"
"github.com/beingnoble03/octern-main/initializers"
"github.com/beingnoble03/octern-main/middlewares"
"github.com/gin-gonic/gin"
)
func init() {
initializers.LoadEnvVariables()
initializers.ConnectToDb()
initializers.SyncDb()
fmt.Println("Initiated")
}
func main() {
r := gin.Default()
// A user needs to be created in the database without the API.
r.GET("/validate", middlewares.CheckAuth, handlers.Greeting)
r.POST("/createOrganization", middlewares.CheckAuth, controllers.CreateOrganization)
r.POST("/makeUserAdmin", handlers.MakeUserAdmin)
r.GET("/getUsersFromOrganization/:id", middlewares.CheckAuth, handlers.GetUsersFromOrganization)
r.POST("/createUser", middlewares.CheckAuth, controllers.CreateUser)
r.POST("/login", controllers.Login)
r.POST("/removeMember", middlewares.CheckAuth, handlers.RemoveMember)
r.GET("/logout", middlewares.CheckAuth, controllers.Logout)
r.Run()
}