Skip to content

Commit

Permalink
added www folder and index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
kgolding committed Feb 3, 2020
1 parent 88db62e commit fdc2fb0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Binary file added go-simple-http-server
Binary file not shown.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
)

func main() {
http.HandleFunc("/", handler)
http.HandleFunc("/hello", handler)
http.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir("www"))))
http.ListenAndServe(":8080", nil)
}

func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello %s!", r.URL.Path[1:])
fmt.Fprint(w, "Hello !")
}
8 changes: 8 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<title>Go Simple HTTP Server</title>
</head>
<body>
<h1>Go Simple HTTP Server</h1>
</body>
</head>

0 comments on commit fdc2fb0

Please sign in to comment.