title: How do you serve a static html file using a go web server?
body: <p>How do you serve index.html (or some other static HTML file) using a go web server?</p>
  
  <p>I just want a basic, static HTML file (like an article, for example) which I can serve from a go web server.  The HTML should be modifiable outside of the go program, as it would be in the case while using HTML templates.</p>
  
  <p>This is my web server which only hosts hard-coded text ("Hello world!").</p>
  
  <pre><code>package main
  
  import (
    "fmt"
    "net/http"
  )
  
  func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "Hello world!")
  }
  
  func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":3000", nil)
  }
  </code></pre>