-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (32 loc) · 1.13 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
package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
)
func routes() {
http.HandleFunc("/", LoginPageHandler)
http.HandleFunc("/register", RegisterPageHandler)
http.HandleFunc("/login", LoginHandler)
http.HandleFunc("/logout", LogoutHandler)
}
var router = mux.NewRouter()
func main() {
routers()
/*
// Загрузка стилей проекта
router.PathPrefix("/assets/").Handler(http.StripPrefix("/assets/", http.FileServer(http.Dir("./assets"))))
router.HandleFunc("/", Logger(common.LoginPageHandler)) // GET
router.HandleFunc("/index", Logger(common.IndexPageHandler)) // GET
router.HandleFunc("/login", Logger(common.LoginHandler)).Methods("POST")
router.HandleFunc("/register", Logger(common.RegisterPageHandler)).Methods("GET")
router.HandleFunc("/register", Logger(common.RegisterHandler)).Methods("POST")
router.HandleFunc("/logout", Logger(common.LogoutHandler)).Methods("POST")
// Manage page (admin)
router.HandleFunc("/manage", Logger(common.ManageHandler)) // GET
*/
http.Handle("/", router)
log.Print("Server: start")
log.Print("Server: port:8080")
http.ListenAndServe(":8080", nil)
}