Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- API
- mutex
- C
- windows
- GO 언어
- Golang
- json
- 영화
- c++
- range
- 책
- install
- package
- tcp
- File
- Linux
- http
- window
- 리뷰
- Python
- go
- JavaScript
- go언어
- FOR
- write
- Sync
- bitcoin
- channel
- Close
- Callback
Archives
- Today
- Total
목록post (1)
Code Habit
Golang ) http 서버 - Get/Post 요청 처리하기
앞에서 포스팅한 "net/http" 패키지로 http 서버 구현 후 Get/Post 요청을 구분하여 처리하는 예제이다. 예제 - 서버 // main.go package main import ( "fmt" "io/ioutil" "net/http" ) func handler(rw http.ResponseWriter, req *http.Request) { fmt.Println("Method : ", req.Method) fmt.Println("URL : ", req.URL) fmt.Println("Header : ", req.Header) b, _ := ioutil.ReadAll(req.Body) defer req.Body.Close() fmt.Println("Body : ", string(b)) switch..
카테고리 없음
2020. 6. 24. 07:19