forked from GreggJuanEduardoPH/Go-Mini-Social-Network
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
75 lines (58 loc) · 1.69 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package main
import (
R "Go-Mini-Social-Network/routes"
"os"
"github.com/joho/godotenv"
"github.com/gin-gonic/gin"
"github.com/urfave/negroni"
)
func init() {
godotenv.Load()
}
func main() {
router := gin.Default()
router.LoadHTMLGlob("views/*.html")
user := router.Group("/user")
{
user.POST("/signup", R.UserSignup)
user.POST("/login", R.UserLogin)
}
router.GET("/", R.Index)
router.GET("/welcome", R.Welcome)
router.GET("/explore", R.Explore)
router.GET("/404", R.NotFound)
router.GET("/signup", R.Signup)
router.GET("/login", R.Login)
router.GET("/logout", R.Logout)
router.GET("/deactivate", R.Deactivate)
router.GET("/edit_profile", R.EditProfile)
router.GET("/create_post", R.CreatePost)
router.GET("/profile/:id", R.Profile)
router.GET("/profile", R.NotFound)
router.GET("/view_post/:id", R.ViewPost)
router.GET("/view_post", R.NotFound)
router.GET("/edit_post/:id", R.EditPost)
router.GET("/edit_post", R.NotFound)
router.GET("/followers/:id", R.Followers)
router.GET("/followers", R.NotFound)
router.GET("/followings/:id", R.Followings)
router.GET("/followings", R.NotFound)
router.GET("/likes/:id", R.Likes)
router.GET("/likes", R.NotFound)
api := router.Group("/api")
{
api.POST("/create_new_post", R.CreateNewPost)
api.POST("/delete_post", R.DeletePost)
api.POST("/update_post", R.UpdatePost)
api.POST("/update_profile", R.UpdateProfile)
api.POST("/change_avatar", R.ChangeAvatar)
api.POST("/follow", R.Follow)
api.POST("/unfollow", R.Unfollow)
api.POST("/like", R.Like)
api.POST("/unlike", R.Unlike)
api.POST("/deactivate-account", R.DeactivateAcc)
}
server := negroni.Classic()
server.UseHandler(router)
server.Run(os.Getenv("PORT"))
}