Basic http program

This commit is contained in:
chopster44 committed 2023-07-16 14:23:32 +01:00
1 parent 4e346d8113
commit 6e78a0ec88
2 files changed
+9 -2

No files matched your search

Executable
BIN
View File
Binary file not shown.
+9 -2
View File
@@ -2,8 +2,15 @@ package main
import ( import (
"fmt" "fmt"
"log"
"net/http"
) )
func main() { func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
} }