Add static file serving
This commit is contained in:
parent
25ce14f45d
commit
166fbc804c
4
main.go
4
main.go
|
@ -213,13 +213,13 @@ func pasteHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
router := mux.NewRouter().StrictSlash(true)
|
router := mux.NewRouter()
|
||||||
router.PathPrefix("/").Handler(http.StripPrefix("/", http.FileServer(http.Dir("static/"))))
|
|
||||||
router.HandleFunc("/p/{pasteId}", pasteHandler)
|
router.HandleFunc("/p/{pasteId}", pasteHandler)
|
||||||
router.HandleFunc("/p/{pasteId}/{lang}", langHandler)
|
router.HandleFunc("/p/{pasteId}/{lang}", langHandler)
|
||||||
router.HandleFunc("/save", saveHandler)
|
router.HandleFunc("/save", saveHandler)
|
||||||
router.HandleFunc("/save/{output}", saveHandler)
|
router.HandleFunc("/save/{output}", saveHandler)
|
||||||
router.HandleFunc("/del/{pasteId}/{delKey}", delHandler)
|
router.HandleFunc("/del/{pasteId}/{delKey}", delHandler)
|
||||||
|
router.PathPrefix("/").Handler(http.StripPrefix("/", http.FileServer(http.Dir("static/"))))
|
||||||
err := http.ListenAndServe(PORT, router)
|
err := http.ListenAndServe(PORT, router)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue