refactor(web): migrate create-react-app to vite (#823)

* fix(build): dockerignore add exclusions

* fix: baseurl and build

* chore: removed react-app-env instead use vite

* chore: updated server and embedding static files.

* commented because conflict I believe, and not needed.

* docs: updated readme

* chore: updated json and added vite

* chore: import fix

* chore: updated yarn.lock and package json

* build: add empty dist to compile backend

* fix: use / as default baseurl

---------

Co-authored-by: KaiserBh <kaiserbh@proton.me>
Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
KaiserBh 2023-04-10 22:28:24 +10:00 committed by GitHub
parent 33897b04a1
commit 1cdbbe5bf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 717 additions and 9474 deletions

View file

@ -2,7 +2,6 @@ package http
import (
"fmt"
"io/fs"
"net"
"net/http"
@ -105,18 +104,8 @@ func (s Server) Handler() http.Handler {
r.Use(c.Handler)
//r.Get("/", index)
//r.Get("/dashboard", dashboard)
//handler := web.AssetHandler("/", "build")
encoder := encoder{}
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)
})
web.RegisterHandler(r)
r.Route("/api", func(r chi.Router) {
r.Route("/auth", newAuthHandler(encoder, s.log, s.config.Config, s.cookieStore, s.authService).Routes)
@ -153,7 +142,7 @@ func (s Server) Handler() http.Handler {
})
})
//r.HandleFunc("/*", handler.ServeHTTP)
// serve the parsed index.html
r.Get("/", s.index)
r.Get("/*", s.index)