Backend Runtimes
Go (Golang & Gin) Backend Integration
High-throughput, sub-millisecond Go middleware and client libraries for microservices and API gateways.
Go Standard Library / Gin Middleware
Perform non-blocking HTTP requests to the ParityEdge Global Edge API:
package main
import (
"encoding/json"
"fmt"
"net/http"
"time"
)
type ParityResult struct {
Eligible bool `json:"eligible"`
CountryCode string `json:"countryCode"`
CountryName string `json:"countryName"`
DiscountPercentage int `json:"discountPercentage"`
CouponCode string `json:"couponCode"`
}
var httpClient = &http.Client{
Timeout: 2 * time.Second,
}
func ResolveParity(projectID, clientIP string) (*ParityResult, error) {
url := fmt.Sprintf("https://api.parityedge.app/v1/lookup?pid=%s", projectID)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}
req.Header.Set("x-forwarded-for", clientIP)
resp, err := httpClient.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
var result ParityResult
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return nil, err
}
return &result, nil
}Next: PHP & Laravel Guide
Integrate ParityEdge into Laravel, WooCommerce, and WordPress storefronts.