running for local dev
This commit is contained in:
18
Makefile
18
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: help deps fmt lint test build build-api build-import run dev api api-binary docker-up docker-down docker-logs db-shell import-data clean web-install web-dev web-build web-lint web-preview
|
||||
.PHONY: help deps fmt lint test build build-api build-import api docker-up docker-down docker-logs db-shell import-data devstack clean web-install web-dev web-build web-lint web-preview web-test
|
||||
|
||||
GO ?= go
|
||||
DOCKER_COMPOSE ?= docker-compose
|
||||
@@ -36,12 +36,6 @@ build-api: ## Build API server binary
|
||||
@echo "Building API server..."
|
||||
@$(GO) build -o $(API_BIN) ./cmd/api
|
||||
|
||||
run: ## Run the API server (local env)
|
||||
@$(GO) run ./cmd/api/main.go
|
||||
|
||||
dev: ## Run API server with auto-reload (requires air)
|
||||
@air
|
||||
|
||||
# Database / Docker
|
||||
docker-up: ## Start PostgreSQL/PostGIS container
|
||||
@$(DOCKER_COMPOSE) up -d
|
||||
@@ -67,9 +61,10 @@ api: docker-up ## Start API server (go run) against containerized DB
|
||||
@echo "Starting API server on :8080..."
|
||||
@$(GO) run ./cmd/api/main.go
|
||||
|
||||
api-binary: docker-up build-api ## Start API server from compiled binary
|
||||
@echo "Starting compiled API server on :8080..."
|
||||
@./$(API_BIN)
|
||||
# Full-stack local dev helper
|
||||
devstack: import-data ## Start DB, import KML data, then run API server
|
||||
@echo "Starting API server on :8080..."
|
||||
@$(GO) run ./cmd/api/main.go
|
||||
|
||||
# Frontend (Vite/React/Tailwind)
|
||||
web-install: ## Install web dependencies
|
||||
@@ -87,6 +82,9 @@ web-lint: ## Lint frontend
|
||||
web-preview: ## Preview built frontend
|
||||
@npm run preview --prefix $(WEB_DIR)
|
||||
|
||||
web-test: ## Run frontend tests
|
||||
@npm test --prefix $(WEB_DIR)
|
||||
|
||||
clean: ## Clean build artifacts
|
||||
@rm -rf bin/
|
||||
@echo "Cleaned build artifacts"
|
||||
|
||||
60
web/package-lock.json
generated
60
web/package-lock.json
generated
@@ -1809,6 +1809,66 @@
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": {
|
||||
"version": "1.7.1",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.1.0",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": {
|
||||
"version": "1.7.1",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.1.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
|
||||
"version": "1.1.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/core": "^1.7.1",
|
||||
"@emnapi/runtime": "^1.7.1",
|
||||
"@tybys/wasm-util": "^0.10.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": {
|
||||
"version": "0.10.1",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
|
||||
"version": "4.1.18",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.18.tgz",
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@import "tailwindcss";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { BBoxResponse } from '../types/api';
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8080/api/v1';
|
||||
// Default to same-origin API with Vite dev proxy; override via VITE_API_URL for other environments.
|
||||
const API_BASE_URL = import.meta.env.VITE_API_URL || '/api/v1';
|
||||
|
||||
export async function fetchTimelineEvents() {
|
||||
const response = await fetch(`${API_BASE_URL}/timeline/events`);
|
||||
|
||||
@@ -4,6 +4,15 @@ import react from '@vitejs/plugin-react'
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
proxy: {
|
||||
// Proxy API calls during dev to the Go backend
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
|
||||
Reference in New Issue
Block a user