blob: f4bf4a864ffe16924ddab7e3342afee048468cd8 [file] [log] [blame]
package main
import (
"net/http"
)
// create a handler struct
type HttpHandler struct{}
// implement `ServeHTTP` method on `HttpHandler` struct
func (h HttpHandler) ServeHTTP(res http.ResponseWriter, req *http.Request) {
// create response binary data
data := []byte("Hello World X509!") // slice of bytes
// write `data` to response
res.Write(data)
}
func main() {
// create a new handler
handler := HttpHandler{}
// listen and serve
http.ListenAndServe(":9000", handler)
}