21 lines
573 B
Go
21 lines
573 B
Go
package server
|
|
|
|
import (
|
|
"embed"
|
|
"net/http"
|
|
)
|
|
|
|
//go:embed static
|
|
var staticFS embed.FS
|
|
|
|
func (s *Server) routes(mux *http.ServeMux) {
|
|
mux.HandleFunc("GET /", s.handleRoot)
|
|
mux.HandleFunc("GET /p/{path...}", s.handlePage)
|
|
mux.HandleFunc("GET /search", s.handleSearch)
|
|
mux.HandleFunc("GET /dl/page/{path...}", s.handleDownloadPage)
|
|
mux.HandleFunc("GET /dl/book.md", s.handleDownloadBook)
|
|
mux.HandleFunc("GET /dl/book.pdf", s.handleDownloadPDF)
|
|
mux.HandleFunc("GET /dl/book.html", s.handleDownloadPrintHTML)
|
|
mux.Handle("GET /static/", http.FileServerFS(staticFS))
|
|
}
|