scanfile/server/internal/server/routes.go

27 lines
815 B
Go

package server
import (
"net/http"
"git.jmbit.de/jmb/scanfile/server/api"
"git.jmbit.de/jmb/scanfile/server/web"
)
func RegisterRoutes() *http.ServeMux {
mux := http.NewServeMux()
// Web interface
mux.HandleFunc("/", web.IndexWebHandler)
mux.HandleFunc("/about", web.AboutWebHandler)
mux.HandleFunc("/admin", web.AdminWebHandler)
mux.HandleFunc("/files/{uuid}", web.FileViewWebHandler)
mux.HandleFunc("/files/{uuid}/msoffice", web.FileViewMSOWebHandler)
mux.HandleFunc("/files/{uuid}/download", web.FileViewDownloadWebHandler)
mux.HandleFunc("/files/{uuid}/delete", web.FileViewDeleteWebHandler)
mux.HandleFunc("POST /upload", web.IndexUploadHandler)
mux.Handle("/assets/", http.FileServer(http.FS(web.Files)))
// REST API
mux.HandleFunc("/api/v0/submit", api.SubmitRestHandler)
return mux
}