-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.go
110 lines (85 loc) · 3.8 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package main
import (
"log"
"net/http"
"techpro.club/sources/common"
"techpro.club/sources/libraries"
"techpro.club/sources/pages"
"techpro.club/sources/pages/contributors"
"techpro.club/sources/pages/institutes"
"techpro.club/sources/pages/projects"
"techpro.club/sources/pages/videos"
"github.com/gorilla/mux"
"github.com/joho/godotenv"
)
func init() {
// loads values from .env into the system
if err := godotenv.Load(); err != nil {
log.Fatal("No .env file found")
}
}
func main() {
goMux := mux.NewRouter()
goMux.PathPrefix("/assets/").Handler(http.StripPrefix("/assets/", http.FileServer(http.Dir("assets"))))
// APIs
goMux.HandleFunc("/api/managereaction", pages.ManageReactions)
goMux.HandleFunc("/api/managebookmark", pages.ManageBookmarks)
goMux.HandleFunc("/api/marknotificationsread", pages.MarkNotificationRead)
goMux.HandleFunc("/api/deleteuser", pages.DeleteUser)
goMux.HandleFunc("/api/deleteproject", projects.DeleteProject)
// Templates
goMux.HandleFunc("/", pages.IndexHandler)
goMux.HandleFunc("/contactus", pages.ContactUs)
goMux.HandleFunc("/careers", pages.Careers)
goMux.HandleFunc("/company", pages.Company)
goMux.HandleFunc("/brand", pages.Brand)
goMux.HandleFunc("/campus", pages.Campus)
goMux.HandleFunc("/campusonboard", pages.CampusOnboard)
goMux.HandleFunc("/videos", pages.Videos)
goMux.HandleFunc("/privacy-policy", pages.PrivacyPolicy)
goMux.HandleFunc("/cookie-policy", pages.CookiePolicy)
goMux.HandleFunc("/terms-and-conditions", pages.TermsOfService)
// Users
goMux.HandleFunc("/users/editprofile", pages.UserEdit)
goMux.HandleFunc("/users/profile/{username}", pages.PublicProfile)
goMux.HandleFunc("/users/profile", pages.Profile)
goMux.HandleFunc("/users/notifications", pages.Notifications)
goMux.HandleFunc("/users/settings", pages.UserSettings)
goMux.HandleFunc("/users/profiletest/{username}", pages.ProfileTest)
// Templates/Contributors
goMux.HandleFunc("/contributors/feeds", contributors.Feeds)
goMux.HandleFunc("/contributors/videofeeds", contributors.VideoFeeds)
goMux.HandleFunc("/contributors/preferences", contributors.Preferences)
goMux.HandleFunc("/contributors/thankyou", contributors.PreferencesSaved)
goMux.HandleFunc("/contributors/reactions", contributors.FetchReactions)
goMux.HandleFunc("/contributors/bookmarks", contributors.FetchBookmarks)
//Template/Institute
goMux.HandleFunc("/institute/register", institutes.Register)
// Templates/Projects
goMux.HandleFunc("/projects/create", projects.ProjectCreate)
goMux.HandleFunc("/projects/list", projects.ProjectList)
goMux.HandleFunc("/projects/view", projects.ProjectPreview)
goMux.HandleFunc("/projects/edit", projects.ProjectEdit)
goMux.HandleFunc("/projects/thankyou", projects.ProjectSaved)
// Templates/Videos
goMux.HandleFunc("/videos/list", videos.VideosList)
goMux.HandleFunc("/videos/newvideo", videos.NewVideo)
goMux.HandleFunc("/videos/editvideo", videos.EditVideo)
// Libraries
// Github
goMux.HandleFunc("/contributors/github/login", libraries.GithubContributorLoginHandler)
goMux.HandleFunc("/contributors/github/callback", libraries.GithubContributorCallbackHandler)
goMux.HandleFunc("/projects/github/login", libraries.GithubProjectLoginHandler)
goMux.HandleFunc("/projects/github/callback", libraries.GithubProjectCallbackHandler)
// Google
goMux.HandleFunc("/contributors/google/login", libraries.GoogleContributorLoginHandler)
goMux.HandleFunc("/contributors/google/callback", libraries.GoogleContributorCallbackHandler)
// Func to receive data after login
goMux.HandleFunc("/github/loggedin", func(w http.ResponseWriter, r *http.Request) {
libraries.GithubLoggedinHandler(w, r, "", "", "", "")
})
goMux.HandleFunc("/logout", pages.Logout)
// Start the web server
// http.Handle("/", goMux)
http.ListenAndServe( common.CONST_APP_PORT, goMux)
}