Skip to content

Commit 2d3c13d

Browse files
author
zainhoda
committed
hello world
hello world
1 parent c2b04ed commit 2d3c13d

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

main.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package main
2+
3+
import (
4+
"io"
5+
"log"
6+
"net/http"
7+
)
8+
9+
// hello world, the web server
10+
func HelloServer(w http.ResponseWriter, req *http.Request) {
11+
io.WriteString(w, "hello, world!\n")
12+
}
13+
14+
func main() {
15+
http.HandleFunc("/hello", HelloServer)
16+
err := http.ListenAndServe(":12345", nil)
17+
if err != nil {
18+
log.Fatal("ListenAndServe: ", err)
19+
}
20+
}

0 commit comments

Comments
 (0)