- Implement standalone Go backend API server using Gin and pure-Go SQLite (modernc.org/sqlite) - Add 11-table schema DDL migrations (000001_init.up.sql) based on DATA_TABLE.md - Add seed data ingestion tool (cmd/seed) and static TypeScript content exporter (cmd/export-content) - Add configuration loader (internal/config) supporting environment variables and .env files (HOST, PORT, DB_PATH, GIN_MODE, CORS_ALLOW_ORIGINS, AUTO_MIGRATE) - Add lightweight multi-stage Dockerfile and docker-compose.yml with persistent SQLite volume - Add comprehensive architecture specification (ARCHITECTURE.md) and REST API interface specification (API_INTERFACE.md) - Harmonize frontend publications page to consume isHighlight flag from database-synced content
40 lines
839 B
Makefile
40 lines
839 B
Makefile
.PHONY: all build run seed export-content test fmt fmt-check vet clean
|
|
|
|
BIN_DIR := bin
|
|
DB_PATH := anl.db
|
|
|
|
all: fmt-check vet build test
|
|
|
|
build:
|
|
@mkdir -p $(BIN_DIR)
|
|
@echo "Building api server..."
|
|
go build -o $(BIN_DIR)/api ./cmd/api
|
|
@echo "Building seeder..."
|
|
go build -o $(BIN_DIR)/seed ./cmd/seed
|
|
@echo "Building content exporter..."
|
|
go build -o $(BIN_DIR)/export-content ./cmd/export-content
|
|
|
|
run: build
|
|
./$(BIN_DIR)/api --db $(DB_PATH)
|
|
|
|
seed: build
|
|
./$(BIN_DIR)/seed --db $(DB_PATH) --seed-dir seed/data
|
|
|
|
export-content: build
|
|
./$(BIN_DIR)/export-content --db $(DB_PATH) --out-dir ../refer_landing_page/content
|
|
|
|
fmt:
|
|
gofmt -w .
|
|
|
|
fmt-check:
|
|
@test -z "$$(gofmt -l .)" || (echo "gofmt check failed on files:" && gofmt -l . && exit 1)
|
|
|
|
vet:
|
|
go vet ./...
|
|
|
|
test: fmt-check vet
|
|
go test -v ./...
|
|
|
|
clean:
|
|
rm -rf $(BIN_DIR) *.db*
|