28 lines
626 B
Go
28 lines
626 B
Go
package main
|
|
|
|
import (
|
|
"path/filepath"
|
|
"net/http"
|
|
"fmt"
|
|
)
|
|
|
|
func index(w http.ResponseWriter, r *http.Request) {
|
|
http.Redirect(w, r, "/contact", http.StatusMovedPermanently)
|
|
}
|
|
|
|
func static(w http.ResponseWriter, r *http.Request) {
|
|
http.ServeFile(w, r, r.URL.Path)
|
|
}
|
|
|
|
func css(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Println(filepath.Join("css", getParam(r, 0)))
|
|
http.ServeFile(w, r, filepath.Join("css", getParam(r, 0)))
|
|
}
|
|
|
|
func html(w http.ResponseWriter, r *http.Request) {
|
|
if t, found := TMPL[getParam(r, 0)]; found {
|
|
w.Write(t)
|
|
} else {
|
|
http.NotFound(w, r)
|
|
}
|
|
}
|