mirror of
https://github.com/get-drexa/drive.git
synced 2026-02-02 16:01:17 +00:00
- Add swaggo annotations to all HTTP handlers - Add Swagger/OpenAPI spec generation with swag - Create separate docs server binary (drexa-docs) - Add Makefile with build, run, and docs targets - Configure Scalar as the API documentation UI Run 'make docs' to regenerate, 'make run-docs' to serve.
42 lines
969 B
Makefile
42 lines
969 B
Makefile
.PHONY: build build-docs build-all run run-docs docs install-tools fmt clean
|
|
|
|
# Build the API server
|
|
build:
|
|
go build -o bin/drexa ./cmd/drexa
|
|
|
|
# Build the documentation server
|
|
build-docs:
|
|
go build -o bin/drexa-docs ./cmd/docs
|
|
|
|
# Build all binaries
|
|
build-all: build build-docs
|
|
|
|
# Run the API server
|
|
run:
|
|
go run ./cmd/drexa --config config.yaml
|
|
|
|
# Run the documentation server
|
|
run-docs:
|
|
go run ./cmd/docs --port 8081 --api-url http://localhost:8080
|
|
|
|
# Generate API documentation
|
|
docs:
|
|
@echo "Generating OpenAPI documentation..."
|
|
swag init -g cmd/drexa/main.go -o docs --parseDependency --parseInternal --outputTypes go,json,yaml
|
|
@echo "Documentation generated in docs/"
|
|
@echo "Run 'make run-docs' to start the documentation server"
|
|
|
|
# Install development tools
|
|
install-tools:
|
|
go install github.com/swaggo/swag/cmd/swag@latest
|
|
|
|
# Format and lint
|
|
fmt:
|
|
go fmt ./...
|
|
swag fmt
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
rm -rf bin/
|
|
rm -f docs/swagger.json docs/swagger.yaml
|