Instantly share code, notes, and snippets.

View web-routing-httprouter-mux.go
package main
import (
"fmt"
"github.com/julienschmidt/httprouter"
"log"
"net/http"
)
func HomeHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
View template-html-5.go
package main
import (
"github.com/julienschmidt/httprouter"
"html/template"
"log"
"net/http"
)
func Home(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
View template-html-4.go
package main
import (
"github.com/julienschmidt/httprouter"
"html/template"
"log"
"net/http"
)
func Home(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
View template-html-3.go
package main
import (
"github.com/julienschmidt/httprouter"
"html/template"
"log"
"net/http"
)
func Home(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
View template-html-2.go
package main
import (
"github.com/julienschmidt/httprouter"
"html/template"
"log"
"net/http"
)
func Home(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
View template-html.go
package main
import (
"github.com/julienschmidt/httprouter"
"html/template"
"log"
"net/http"
)
func Home(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
View get-local-ip-address.go
package main
import (
"fmt"
"log"
"net"
)
func main() {
conn, err := net.Dial("udp", "8.8.8.8:80")
View index4.html
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>My Title</title>
</head>
<body>
<table>
{{range .}}
<tr>
View index3.html
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>My Title</title>
</head>
<body>
My name is {{.Name}} and my age is {{.Age}}.
</body>
</html>
View index2.html
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>My Title</title>
</head>
<body>
My name is {{.}}.
</body>
</html>