### Start Development Servers Source: https://github.com/samber/go-mod-graph/blob/main/README.md Run these commands in separate terminals to start the Go proxy server and the frontend development server for local development. ```bash # Terminal 1: Start the Go proxy server cd proxy go run main.go ``` ```bash # Terminal 2: Start the frontend dev server cd app npm run dev ``` -------------------------------- ### Install Go Module Graph Proxy Source: https://github.com/samber/go-mod-graph/blob/main/proxy/README.md Installs the Go module graph proxy by initializing the Go module and fetching dependencies. ```bash cd proxy go mod init go-mod-graph-proxy go get . ``` -------------------------------- ### Proxy Request Example Source: https://github.com/samber/go-mod-graph/blob/main/proxy/README.md Demonstrates how to make a GET request to the proxy endpoint to retrieve Go module information. Ensure the path and proxy parameters are correctly encoded. ```http GET http://localhost:8080/proxy?path=/github.com/stretchr/testify/@v/list ``` -------------------------------- ### Configure Frontend Environment Variable Source: https://github.com/samber/go-mod-graph/blob/main/app/CLAUDE.md Example of an .env file for the frontend application, specifying the URL for the local Go module proxy server. ```bash VITE_GO_MOD_PROXY_URL=http://localhost:8080 ``` -------------------------------- ### Run Go Module Graph Proxy in Development Source: https://github.com/samber/go-mod-graph/blob/main/proxy/README.md Starts the Go module graph proxy server for local development. The server will be accessible at http://localhost:8080. ```bash # From the proxy directory go run main.go ``` -------------------------------- ### Running Both Frontend and Proxy Servers Simultaneously Source: https://github.com/samber/go-mod-graph/blob/main/app/CLAUDE.md Instructions for running both the frontend development server and the proxy server concurrently using separate terminals. This setup is useful for full-stack development. ```bash # Terminal 1 cd proxy && go run main.go # Terminal 2 cd app && npm run dev ``` -------------------------------- ### Update Frontend and Install Package Source: https://github.com/samber/go-mod-graph/blob/main/app/CLAUDE.md Commands to update frontend dependencies by checking for outdated packages and installing the latest version of a specific package. ```bash # Frontend cd app npm outdated npm install package@latest ``` -------------------------------- ### Go Module Proxy Request Format Source: https://github.com/samber/go-mod-graph/blob/main/app/CLAUDE.md This example shows the format for requests made to the proxy server, including the local proxy address and the path to the Go module proxy. ```go http://localhost:8080/proxy?path=/github.com/stretchr/testify/@v/list&proxy=https://proxy.golang.org ``` -------------------------------- ### Frontend Development Commands Source: https://github.com/samber/go-mod-graph/blob/main/app/CLAUDE.md Commands to set up and run the frontend development server using npm. Ensure you are in the 'app' directory. ```bash cd app npm install npm run dev # Start dev server on http://localhost:5173 npm run build # Build for production npm run lint # Run ESLint ``` -------------------------------- ### Configure Production Environment Variables and Build Source: https://github.com/samber/go-mod-graph/blob/main/README.md Set environment variables for proxy URL, allowed origins, and port before building the frontend and the Go proxy server for production deployment. ```bash export VITE_GO_MOD_PROXY_URL=xxxx export ALLOWED_ORIGINS=yyyy export PORT=8080 # Build the frontend cd app npm run build ``` ```bash # Build the Go proxy server cd ../proxy go build -o go-mod-graph-proxy main.go ``` -------------------------------- ### Proxy Server Development Commands Source: https://github.com/samber/go-mod-graph/blob/main/app/CLAUDE.md Commands to build and run the Go proxy server. Ensure you are in the 'proxy' directory for running, or the project root for building. ```bash cd proxy go run main.go # Start proxy server on http://localhost:8080 go build -o ../dist/go-mod-graph-proxy main.go ``` -------------------------------- ### Build and Run Go Module Graph Proxy Source: https://github.com/samber/go-mod-graph/blob/main/proxy/README.md Builds the Go module graph proxy executable and then runs it. This is the standard procedure for deploying or running the application after development. ```bash go build -o go-mod-graph-proxy main.go ./go-mod-graph-proxy ``` -------------------------------- ### Console Log for Loaded Dependencies Source: https://github.com/samber/go-mod-graph/blob/main/app/CLAUDE.md Logs the number of dependencies loaded after a dependency graph is processed. This is a simple informational message. ```text Loaded 42 dependencies for github.com/stretchr/testify@latest ``` -------------------------------- ### Frontend Integration for Go Proxy Source: https://github.com/samber/go-mod-graph/blob/main/proxy/README.md TypeScript function to fetch data from the Go module proxy, utilizing the local proxy server. It handles URL construction and basic error checking. ```typescript const fetchFromProxy = async (proxyUrl: string, path: string): Promise => { // Use local proxy instead of direct call const localProxyUrl = 'http://localhost:8080'; const url = `${localProxyUrl}/proxy?path=${encodeURIComponent(path)}&proxy=${encodeURIComponent(proxyUrl)}`; const response = await fetch(url); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.text(); }; ``` -------------------------------- ### Proxy Request Source: https://github.com/samber/go-mod-graph/blob/main/proxy/README.md Proxies a Go module request to a specified Go module proxy. This is useful for bypassing CDN restrictions when accessing Go module proxies from the browser. ```APIDOC ## GET /proxy ### Description Proxies a Go module request to a specified Go module proxy. This is useful for bypassing CDN restrictions when accessing Go module proxies from the browser. ### Method GET ### Endpoint /proxy ### Parameters #### Query Parameters - **path** (string) - Required - The Go module path to proxy (e.g., `/github.com/stretchr/testify/@v/list`) - **proxy** (string) - Optional - The target Go module proxy URL (defaults to `https://proxy.golang.org`) ### Request Example ``` GET http://localhost:8080/proxy?path=/github.com/stretchr/testify/@v/list ``` ### Response #### Success Response (200) - The response body will contain the content of the requested Go module path from the specified proxy. ``` -------------------------------- ### Health Check Source: https://github.com/samber/go-mod-graph/blob/main/proxy/README.md Checks the health status of the Go Module Graph Proxy service. ```APIDOC ## GET /health ### Description Checks the health status of the Go Module Graph Proxy service. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **status** (string) - The status of the service (e.g., "ok") - **service** (string) - The name of the service (e.g., "go-mod-graph-proxy") ### Response Example ```json { "status": "ok", "service": "go-mod-graph-proxy" } ``` ``` -------------------------------- ### Health Check Endpoint Source: https://github.com/samber/go-mod-graph/blob/main/proxy/README.md Shows the expected JSON response from the /health endpoint, indicating the service status. ```json {"status":"ok","service":"go-mod-graph-proxy"} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.