-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauthenticateAndGo.go
39 lines (27 loc) · 1.1 KB
/
authenticateAndGo.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 (
"authenticateAndGo/dbAuth"
"authenticateAndGo/socialAuth"
"authenticateAndGo/utils"
"net/http"
"github.com/gorilla/mux"
)
var router = mux.NewRouter()
func main() {
dbAuth.InitDB()
router.HandleFunc("/", dbAuth.LoginPageHandler)
router.HandleFunc("/index", dbAuth.IndexPageHandler)
router.HandleFunc("/login", dbAuth.LoginHandler).Methods("POST")
router.HandleFunc("/register", dbAuth.RegisterHandler).Methods("POST")
router.HandleFunc("/loginGoogle", socialAuth.HandleGoogleLogin)
router.HandleFunc("/loginFB", socialAuth.HandleFacebookLogin)
router.HandleFunc("/loginGH", socialAuth.HandleGHLogin)
router.HandleFunc("/callback", socialAuth.HandleGoogleCallback)
router.HandleFunc("/callbackFB", socialAuth.HandleFacebookCallback)
router.HandleFunc("/callbackGH", socialAuth.HandleGHCallback)
router.HandleFunc("/logout", dbAuth.LogoutHandler).Methods("POST")
fileServer := http.StripPrefix("/templates/", http.FileServer(http.Dir("./templates/")))
router.PathPrefix("/templates/").Handler(fileServer)
http.Handle("/", router)
http.ListenAndServe(utils.GetPort(), router)
}