mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
Revert "refactor(web): migrate create-react-app to vite (#787)"
This reverts commit edae1bbf4b
.
This commit is contained in:
parent
edae1bbf4b
commit
33897b04a1
17 changed files with 9457 additions and 715 deletions
|
@ -2,6 +2,7 @@ package http
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
|
@ -104,8 +105,18 @@ func (s Server) Handler() http.Handler {
|
|||
|
||||
r.Use(c.Handler)
|
||||
|
||||
//r.Get("/", index)
|
||||
//r.Get("/dashboard", dashboard)
|
||||
|
||||
//handler := web.AssetHandler("/", "build")
|
||||
|
||||
encoder := encoder{}
|
||||
web.RegisterHandler(r)
|
||||
|
||||
assets, _ := fs.Sub(web.Assets, "build/static")
|
||||
r.HandleFunc("/static/*", func(w http.ResponseWriter, r *http.Request) {
|
||||
fileSystem := http.StripPrefix("/static/", http.FileServer(http.FS(assets)))
|
||||
fileSystem.ServeHTTP(w, r)
|
||||
})
|
||||
|
||||
r.Route("/api", func(r chi.Router) {
|
||||
r.Route("/auth", newAuthHandler(encoder, s.log, s.config.Config, s.cookieStore, s.authService).Routes)
|
||||
|
@ -142,7 +153,7 @@ func (s Server) Handler() http.Handler {
|
|||
})
|
||||
})
|
||||
|
||||
// serve the parsed index.html
|
||||
//r.HandleFunc("/*", handler.ServeHTTP)
|
||||
r.Get("/", s.index)
|
||||
r.Get("/*", s.index)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue