diff --git a/Makefile b/Makefile index 03d6d11f..19b0747b 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ deps: ## Install required dependencies cd frontend/ && npm install .PHONY: build -build: ## Build the Go project. +build: ## Build the project npm run build --prefix frontend/ go build -ldflags="-s -w" -trimpath -o ./bin/hajimari ./cmd/hajimari/main.go @@ -19,8 +19,16 @@ run: build ## Run the program ./bin/hajimari .PHONY: dev -dev: ## Run the program in dev mode - (trap 'kill 0' SIGINT; air & sleep 5 && cd frontend/ && npm run dev -- --open) +dev: ## Run the frontend & backend in dev mode + make -j 2 dev-backend dev-frontend + +.PHONY: dev-backend +dev-backend: ## Run the backend in dev mode + air & + +.PHONY: dev-frontend +dev-frontend: ## Run the frontend in dev mode + cd frontend/ && sleep 3 && npm run dev -- --open .PHONY: fmt fmt: ## Format the project with gofmt diff --git a/frontend/.gitignore b/frontend/.gitignore index 64007bdd..295220ab 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -8,3 +8,4 @@ node_modules !.env.example .vercel .output +.vite \ No newline at end of file diff --git a/internal/handlers/startpage.go b/internal/handlers/startpage.go index 1461f00f..05a55438 100644 --- a/internal/handlers/startpage.go +++ b/internal/handlers/startpage.go @@ -65,6 +65,11 @@ func (sr *startpageResource) StartpageCtx(next http.Handler) http.Handler { func (sr *startpageResource) GetStartpage(w http.ResponseWriter, r *http.Request) { startpage := r.Context().Value(contextKeyStartpage).(*models.Startpage) + + if len(startpage.Bookmarks) == 0 { + startpage.Bookmarks = []models.BookmarkGroup{} + } + appConfig, err := config.GetConfig() if err != nil { logger.Error("Failed to read configuration for hajimari: ", err)