forked from yTakkar/Go-Mini-Social-Network
-
Notifications
You must be signed in to change notification settings - Fork 16
/
main.go
77 lines (61 loc) · 1.72 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
76
77
package main
import (
R "Iris-Mini-Social-Network/routes"
"os"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/middleware/recover"
)
func main() {
app := iris.New()
app.UseRouter(recover.New())
app.RegisterView(iris.HTML("./views", ".html"))
app.HandleDir("/", iris.Dir("./public"))
user := app.Party("/user")
{
user.Post("/signup", R.UserSignup)
user.Post("/login", R.UserLogin)
}
app.Get("/", R.Index)
app.Get("/welcome", R.Welcome)
app.Get("/explore", R.Explore)
app.Get("/404", R.NotFound)
app.Get("/signup", R.Signup)
app.Get("/login", R.Login)
app.Get("/logout", R.Logout)
app.Get("/deactivate", R.Deactivate)
app.Get("/edit_profile", R.EditProfile)
app.Get("/create_post", R.CreatePost)
app.Get("/profile/:id", R.Profile)
app.Get("/profile", R.NotFound)
app.Get("/view_post/:id", R.ViewPost)
app.Get("/view_post", R.NotFound)
app.Get("/edit_post/:id", R.EditPost)
app.Get("/edit_post", R.NotFound)
app.Get("/followers/:id", R.Followers)
app.Get("/followers", R.NotFound)
app.Get("/followings/:id", R.Followings)
app.Get("/followings", R.NotFound)
app.Get("/likes/:id", R.Likes)
app.Get("/likes", R.NotFound)
api := app.Party("/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)
}
addr := ":8080"
if port := os.Getenv("PORT"); port != "" {
if port[0] != ':' {
port = ":" + port
}
addr = port
}
app.Listen(addr)
}