일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- FOR
- API
- bitcoin
- c++
- install
- Sync
- Callback
- C
- json
- channel
- windows
- GO 언어
- window
- Linux
- tcp
- http
- Close
- mutex
- JavaScript
- 리뷰
- package
- go언어
- go
- write
- 책
- Golang
- Python
- range
- 영화
- File
- Today
- Total
목록HandleFunc (2)
Code Habit

Go언어는 "net/http" 패키지를 통해 편리하게 HTTP서버를 만들 수 있다. func ListenAndServe(addr string, handler Handler) error : 웹 서버를 시작한다. func HandleFunc(pattern string, handler func(ResponseWriter, *Request)) : 경로별로 요청을 처리할 핸들러 함수 등록 type Employee struct { No int Age int Name string } func MakeWebHandler() http.Handler { mux := http.NewServeMux() mux.HandleFunc("/Employee", EmployeeHandler) return mux } func Employ..

golang은 "net/http" 패키지를 통해 간편하게 http 서버를 만들 수 있다. 다음은 서버를 구현하는데 필요한 함수이다. func ListenAndServe(addr string, handler Handler) error : HTTP 연결을 받고, 요청에 응답 func HandleFunc(pattern string, handler func(ResponseWriter, *Request)) : 경로별로 요청을 처리할 핸들러 함수 등록 사용예제 // main.go package main import ( "net/http" ) func main() { http.HandleFunc("/hello", func(res http.ResponseWriter, req *http.Request) { res.Wri..