Wednesday, 7 October 2020

great falls trip

expense
oct-7 phone
oct-8 gas
oct-16 baggage, uber, gas x 3, parking

hours
oct-7 14h
oct-8 12h
oct-9 8h
oct-10 8h
oct-11 8h
oct-12 8h
oct-13 8h
oct-14 12h test flight
oct-15 8h bundle
oct-16 16h 

Tuesday, 6 October 2020

南高加索衝突

go web app 2 templates

 
//tutorial.go
package main

import (
"net/http"
"html/template"
"github.com/gorilla/mux"
)

var templates *template.Template

func indexHandler(w http.ResponseWriter, r *http.Request) {
templates.ExecuteTemplate(w, "index.html", nil)
}

func main() {
templates = template.Must(template.ParseGlob("templates/*.html"))
r := mux.NewRouter()
r.HandleFunc("/", indexHandler).Methods("GET")
http.Handle("/", r)
http.ListenAndServe(":8000", nil)
}

//templates/index.html
<html>

<head>
    <title> awesome amazing page</title>
</head>

<body>
    <h1>Some basic HTML code</h1>
</body>

</html>

reference:

Monday, 5 October 2020

2020年中央广播电视总台中秋晚会

go web app 1 gorilla mux

 package main

import (
"fmt"
"net/http"
"github.com/gorilla/mux"
)

func helloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "hello world")
}

func goodbyeHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "goodbye world")
}

func main() {
r := mux.NewRouter()
r.HandleFunc("/hello", helloHandler).Methods("GET")
r.HandleFunc("/goodbye", goodbyeHandler).Methods("GET")
http.Handle("/", r)
http.ListenAndServe(":8000", nil)
}


reference: