mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-11-13 17:36:12 +08:00
Update 15.2.md
complete 15.2
This commit is contained in:
@@ -93,19 +93,15 @@ func (obj *Typ) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
|
|
||||||
练习 15.2:[webhello2.go](exercises/chapter_15/webhello2.go)
|
练习 15.2:[webhello2.go](exercises/chapter_15/webhello2.go)
|
||||||
|
|
||||||
>编写一个网页服务器监听端口9999,有如下处理函数:
|
编写一个网页服务器监听端口9999,有如下处理函数:
|
||||||
|
|
||||||
>i)当请求`http://localhost:9999/hello/Name`时,响应:`hello Name`(Name需是一个合法的姓,比如Chris或者Madeleine)
|
* 当请求`http://localhost:9999/hello/Name`时,响应:`hello Name`(Name需是一个合法的姓,比如Chris或者Madeleine)
|
||||||
|
|
||||||
>ii)当请求`http://localhost:9999/shouthello/Name`时,响应:`hello NAME`
|
* 当请求`http://localhost:9999/shouthello/Name`时,响应:`hello NAME`
|
||||||
|
|
||||||
练习 15.3:[hello_server.go](exercises/chapter_15/hello_server.go)
|
练习 15.3:[hello_server.go](exercises/chapter_15/hello_server.go)
|
||||||
|
|
||||||
>
|
创建一个空结构`hello`并使它实现`http.Handler`。运行并测试。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 链接
|
## 链接
|
||||||
|
|||||||
Reference in New Issue
Block a user