This is the complete fix for the missing /admin/ route and frontend serving: Backend: - internal/web/web.go: new package with go:embed for web/dist/ - internal/api/router.go: add routes for /admin/, /admin/*, /assets/* - internal/db/db.go: fix SQLite DSN parsing (sqlite:///path -> path) Build system: - Makefile: new 'embed-prep' target copies web/dist to internal/web/dist - make build now runs embed-prep -> frontend/build automatically Deployment: - deploy/llamalink.service: remove invalid --host/--port flags, add EnvironmentFile=/etc/llamalink/env Verified: - /health returns 200 - /admin/ serves Vue SPA HTML - /assets/* serves CSS and JS files from embedded FS - sqlite:///./llamalink.db works correctly
This commit is contained in:
@@ -24,12 +24,19 @@ GOLINT=golangci-lint
|
||||
# Default target
|
||||
all: deps build
|
||||
|
||||
## build: Build the binary
|
||||
build:
|
||||
## build: Build the binary (includes frontend embed)
|
||||
build: embed-prep
|
||||
@echo "Building $(BINARY)..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY) ./cmd/llamalink
|
||||
|
||||
## embed-prep: Copy web/dist into internal/web/dist for go:embed
|
||||
embed-prep: frontend/build
|
||||
@echo "Preparing embedded frontend..."
|
||||
@rm -rf internal/web/dist
|
||||
@mkdir -p internal/web/dist
|
||||
@cp -r web/dist/* internal/web/dist/
|
||||
|
||||
## run: Build and run
|
||||
run: build
|
||||
@echo "Running..."
|
||||
@@ -63,6 +70,7 @@ deps:
|
||||
## clean: Remove build artifacts
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR) $(DIST_DIR)
|
||||
rm -rf internal/web/dist
|
||||
rm -f coverage.out
|
||||
rm -f *.db
|
||||
|
||||
|
||||
Reference in New Issue
Block a user