Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/router/router.go

34 lignes
1,2 Kio
Go
Brut Vue normale Historique

package router
import (
"github.com/gorilla/mux"
"net/http"
)
var Router *mux.Router
2017-05-06 00:37:59 +02:00
func init() {
Router = mux.NewRouter()
2017-05-07 00:26:02 +02:00
cssHandler := http.FileServer(http.Dir("./public/css/"))
jsHandler := http.FileServer(http.Dir("./public/js/"))
imgHandler := http.FileServer(http.Dir("./public/img/"))
http.Handle("/css/", http.StripPrefix("/public/css/", cssHandler))
http.Handle("/js/", http.StripPrefix("/public/js/", jsHandler))
http.Handle("/img/", http.StripPrefix("/public/img/", imgHandler))
// Routes,
Router.HandleFunc("/", HomeHandler).Name("home")
Router.HandleFunc("/page/{page:[0-9]+}", HomeHandler).Name("home_page")
Router.HandleFunc("/search", SearchHandler).Name("search")
Router.HandleFunc("/search/{page}", SearchHandler).Name("search_page")
Router.HandleFunc("/api/{page}", ApiHandler).Methods("GET")
Router.HandleFunc("/api/view/{id}", ApiViewHandler).Methods("GET")
Router.HandleFunc("/faq", FaqHandler).Name("faq")
2017-05-06 00:37:59 +02:00
Router.HandleFunc("/feed", RssHandler).Name("feed")
Router.HandleFunc("/view/{id}", ViewHandler).Name("view_torrent")
2017-05-06 10:36:37 +02:00
Router.HandleFunc("/upload", UploadHandler).Name("upload")
Router.HandleFunc("/user/register", UserRegisterFormHandler).Name("user_register")
2017-05-06 00:37:59 +02:00
}