Revert "refactor(web): migrate create-react-app to vite (#787)"

This reverts commit edae1bbf4b.
This commit is contained in:
ze0s 2023-04-07 19:08:42 +02:00 committed by GitHub
parent edae1bbf4b
commit 33897b04a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 9457 additions and 715 deletions

View file

@ -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)