|
|
@@ -93,19 +93,15 @@ func (obj *Typ) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|
|
|
|
|
练习 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)
|
|
|
|
|
|
->
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+创建一个空结构`hello`并使它实现`http.Handler`。运行并测试。
|
|
|
|
|
|
|
|
|
## 链接
|