Skip to content

Instantly share code, notes, and snippets.

@asit-dhal
Created September 11, 2016 03:10
Show Gist options
  • Save asit-dhal/924b0c7641b8423c3dccc5dc5eca8152 to your computer and use it in GitHub Desktop.
Save asit-dhal/924b0c7641b8423c3dccc5dc5eca8152 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"html/template"
)
func handler(w http.ResponseWriter, r *http.Request) {
t, _ := template.ParseFiles("view.html") //setp 1
t.Execute(w, "Hello World!") //step 2
}
func main() {
server := http.Server{
Addr: "127.0.0.1:8080",
}
http.HandleFunc("/view", handler)
server.ListenAndServe()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment