forked from Safwanseban/githubstudy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (33 loc) · 938 Bytes
/
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
36
37
38
39
package main
import (
"gin/gorm/controllers"
"gin/gorm/initializers"
"github.com/gin-gonic/gin"
)
var R = gin.Default()
func init() {
R.LoadHTMLGlob("templates/*.html")
initializers.Loadenv()
initializers.Connectodb()
}
func main() {
// R.POST("/Posts", controllers.Postcreate)
R.GET("/", controllers.HomePage)
R.GET("/signup", controllers.Signuppage)
R.POST("/signup", controllers.Signuppagepost)
R.GET("/login", controllers.LoginGet)
R.POST("/login", controllers.LoginPost)
R.GET("/logout", controllers.Logout)
R.GET("/test", controllers.Test)
admin := R.Group("admin")
{
admin.GET("/", controllers.AdminLogin)
admin.POST("/", controllers.AdminLoginPost)
admin.GET("/home", controllers.AdminHome)
admin.GET("/signout", controllers.AdminLogout)
admin.GET("/block/:id", controllers.Block)
admin.GET("/unblock/:id", controllers.Unblock)
}
R.Run() // listen and serve on 0.0.0.0:8080
// /home/{{.ID}}
}