title: Switch from HTTP to HTTPS in Beego
body: <p>I try to switch from HTTP to HTTPS:</p>
  
  <pre><code>func handler(w http.ResponseWriter, req *http.Request) {
      w.Header().Set("Content-Type", "text/plain")
      w.Write([]byte("This is an example server.\n"))
  }
  
  func main() {
      http.HandleFunc("/", handler)
      log.Printf("About to listen on 8080. Go to https://127.0.0.1:8080/")
      err := http.ListenAndServeTLS(":8080", "cert.pem", "key.pem", nil)
      if err != nil {
          log.Fatal(err)
      }
  }
  </code></pre>
  
  <p>And I am getting the following error:</p>
  
  <pre><code>crypto/tls: failed to parse key PEM data
  </code></pre>
  
  <p>My application is running in HTTP mode now and I want it to run in HTTPS mode.</p>
  
  <p>Can anyone suggest how to make it work in HTTPS?</p>