Skip to content

Add Go HTTP REST API server as alternative to hello_go logging demo#1

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/create-sample-go-project
Draft

Add Go HTTP REST API server as alternative to hello_go logging demo#1
Copilot wants to merge 3 commits intomainfrom
copilot/create-sample-go-project

Conversation

Copy link

Copilot AI commented Feb 12, 2026

Requested: Go project with similar structure to sudhirpola/hello_go but different implementation approach.

Created HTTP web server using stdlib net/http instead of third-party logging framework demonstration.

Implementation

  • 3 REST endpoints returning JSON:

    • GET / - welcome message
    • GET /api/hello?name={name} - parameterized greeting
    • GET /health - uptime and status
  • Build infrastructure matching hello_go pattern:

    • Makefile with build/run/test/clean targets
    • Alpine-based Dockerfile
    • Go module at hello-web-server/
  • Error handling: JSON encoding failures log and return HTTP 500

Key Differences from hello_go

hello_go This Implementation
Demonstrates structured logging (dazl) HTTP service with REST API
Third-party logging framework Standard library only
Console output with log levels JSON HTTP responses
YAML logging configuration Zero configuration
// Example handler with error handling
func helloHandler(w http.ResponseWriter, r *http.Request) {
    name := r.URL.Query().Get("name")
    if name == "" {
        name = "World"
    }
    
    response := Response{
        Message:   fmt.Sprintf("Hello, %s!", name),
        Status:    "success",
        Timestamp: time.Now(),
    }
    
    w.Header().Set("Content-Type", "application/json")
    if err := json.NewEncoder(w).Encode(response); err != nil {
        log.Printf("Error encoding JSON response: %v", err)
        http.Error(w, "Internal Server Error", http.StatusInternalServerError)
    }
}
Original prompt

i wanted sample similar to https://github.com/sudhirpola/hello_go , but in diff way


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 12, 2026 09:10
…oach

Co-authored-by: DevipriyaS17 <92732808+DevipriyaS17@users.noreply.github.com>
Co-authored-by: DevipriyaS17 <92732808+DevipriyaS17@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sample Go project structure and implementation Add Go HTTP REST API server as alternative to hello_go logging demo Feb 12, 2026
Copilot AI requested a review from DevipriyaS17 February 12, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants