package main import ( "bytes" "encoding/json" "fmt" "net/http" ) // Function to post data to an endpoint func postData(data map[string]interface{}) error { postURL := "http://localhost:8000/add_website" // Replace with your actual endpoint jsonData, err := json.Marshal(data) if err != nil { return err } resp, err := http.Post(postURL, "application/json", bytes.NewBuffer(jsonData)) if err != nil { return err } defer resp.Body.Close() // Check response status if needed if resp.StatusCode != http.StatusCreated { return fmt.Errorf("unexpected status: %s", resp.Status) } return nil }