Serverside stuff. Mostly shuffling things around
This commit is contained in:
parent
90667d96c7
commit
be70109c43
20 changed files with 513 additions and 71 deletions
22
server/frontendRouter.go
Normal file
22
server/frontendRouter.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Mounted at /
|
||||
func setupFrontendRouter(interactiveFs, noscriptFs fs.FS) http.Handler {
|
||||
router := http.NewServeMux()
|
||||
router.Handle("/noscript/", http.StripPrefix("/noscript", http.FileServerFS(noscriptFs)))
|
||||
router.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFileFS(w, r, interactiveFs, "index.html")
|
||||
})
|
||||
router.Handle("/assets/", http.FileServerFS(interactiveFs))
|
||||
router.HandleFunc(
|
||||
"/robots.txt",
|
||||
func(w http.ResponseWriter, r *http.Request) { http.ServeFileFS(w, r, interactiveFs, "robots.txt") },
|
||||
)
|
||||
|
||||
return router
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue