This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
// '/'경로 핸들러 | |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request){ | |
// welcome | |
fmt.Fprintf(w,"Hello World!") | |
}) | |
http.HandleFunc("/about", func(w http.ResponseWriter, r *http.Request){ | |
// welcome | |
fmt.Fprintf(w, "About") | |
}) | |
http.ListenAndServe(":8080", nil) // 8080 서버시작 | |
} | |
// go run helloworld.go | |
// http://localhost:8080 | |
// http://localhost:8080/about |
반응형
'lang' 카테고리의 다른 글
Revel Frameworkd for Golang (0) | 2019.02.06 |
---|---|
IDEs for Go (0) | 2019.02.04 |
Phantomjs - hello World (0) | 2019.01.28 |
Golang windows path (0) | 2019.01.15 |
GetText 로컬라이즈 방법, ko.po, ko.mo (0) | 2016.12.30 |