new html design
This commit is contained in:
@@ -21,18 +21,11 @@ func HelloHandler(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Hello You")
|
||||
}
|
||||
|
||||
func Home(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/index.html") }
|
||||
func Infra(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/infra.html") }
|
||||
func Finance(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/finance.html") }
|
||||
func Cinema(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/cinema.html") }
|
||||
func Engine(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/engine.html") }
|
||||
func Portfolio(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, "./static/portfolio.html")
|
||||
func staticPage(path, file string) {
|
||||
http.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, "./static/"+file)
|
||||
})
|
||||
}
|
||||
func About(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/about.html") }
|
||||
|
||||
func Styles(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/styles.css") }
|
||||
func Styles2(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/styles2.css") }
|
||||
|
||||
// ---------- Main ----------
|
||||
|
||||
@@ -40,21 +33,22 @@ func main() {
|
||||
port := flag.String("port", "8081", "port to listen on")
|
||||
flag.Parse()
|
||||
|
||||
http.HandleFunc("/styles.css", Styles)
|
||||
http.HandleFunc("/styles2.css", Styles2)
|
||||
fs := http.FileServer(http.Dir("static"))
|
||||
http.Handle("/static/", http.StripPrefix("/static/", fs))
|
||||
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" {
|
||||
http.Redirect(w, r, "/", http.StatusFound)
|
||||
return
|
||||
}
|
||||
About(w, r)
|
||||
http.ServeFile(w, r, "./static/about.html")
|
||||
})
|
||||
//http.HandleFunc("/portfolio", Portfolio)
|
||||
http.HandleFunc("/infra", Infra)
|
||||
http.HandleFunc("/finance", Finance)
|
||||
http.HandleFunc("/cinema", Cinema)
|
||||
http.HandleFunc("/engine", Engine)
|
||||
http.HandleFunc("/portfolio", Portfolio)
|
||||
staticPage("/infra", "infra.html")
|
||||
staticPage("/finance", "finance.html")
|
||||
staticPage("/cinema", "cinema.html")
|
||||
staticPage("/engine", "engine.html")
|
||||
//http.HandleFunc("/portfolio", Portfolio)
|
||||
http.HandleFunc("/git", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "https://git.samantha42.xyz", http.StatusFound)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user