Zest.

Go: HTTP server

A short, tested Go example for http server. Copy it and adjust the names and paths for your project.

Go
package main

import (
    "fmt"
    "net/http"
)

func main() {
    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintln(w, "Hello")
    })
    http.ListenAndServe(":8080", nil)
}

Find it in Zest

Search for “go http server” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More Go examples

All Go examples