GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
sample-golang
/
01_hello
Browse code
move http-server sample
master
1 parent
ae659b6
commit
14d6d1244ae99f6071f01589de44986b6b7e7171
yhornisse
authored
on 27 Sep 2021
Patch
Showing
2 changed files
+0
-16
■
■
■
■
■
httpServer.go
+16
-0
■
■
■
■
■
lib/httpServer.go
Show notes
View
16
■
■
■
■
■
httpServer.go
100644 → 0
package
main
import
(
"fmt"
"net/http"
)
func main
()
{
http
.
HandleFunc
(
"/"
,
handler
)
http
.
ListenAndServe
(
"localhost:8080"
,
nil
)
}
func handler
(
w http
.
ResponseWriter
,
r
*
http
.
Request
)
{
fmt
.
Fprintln
(
w
,
"Hello, World!"
)
}
package main import ( "fmt" "net/http" ) func main() { http.HandleFunc("/", handler) http.ListenAndServe("localhost:8080", nil) } func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello, World!") }
Ignore Space
Show notes
View
16
■
■
■
■
■
lib/httpServer.go
0 → 100644
package
main
import
(
"fmt"
"net/http"
)
func main
()
{
http
.
HandleFunc
(
"/"
,
handler
)
http
.
ListenAndServe
(
"localhost:8080"
,
nil
)
}
func handler
(
w http
.
ResponseWriter
,
r
*
http
.
Request
)
{
fmt
.
Fprintln
(
w
,
"Hello, World!"
)
}
package main import ( "fmt" "net/http" ) func main() { http.HandleFunc("/", handler) http.ListenAndServe("localhost:8080", nil) } func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello, World!") }
Show line notes below