官术网_书友最值得收藏!

Gorilla web toolkit

Now that we have covered how web Restful APIs work, it's time to understand how to best implement them in Go. The Go language comes with a very powerful web package in the standard library; Go also enjoys the support of numerous third-party packages. In this book, we will use a very popular Go web third-party toolkit called Gorilla web toolkit. The Gorilla web toolkit consists of a collection of Go packages that together helps build powerful web applications quickly and efficiently.

The key package in the Gorilla web toolkit ecosystem is called gorilla/mux. The mux package is described in the package documentation as a request router and dispatcher. This is basically a software component that accepts an incoming HTTP request, then decides what to do based on the nature of the request. For example, let's assume that a client sends an HTTP request to our web server. The HTTP router dispatcher component in our web server can then detect that the incoming request includes a GET method with a relative URL of ../events/id/1345. It will then retrieve the information of the event ID 1345 and send it back to the client.

主站蜘蛛池模板: 邢台市| 道真| 江油市| 达州市| 茶陵县| 凤凰县| 永嘉县| 铜山县| 汾西县| 贵州省| 唐河县| 苏尼特左旗| 四平市| 永登县| 禹城市| 天祝| 阳西县| 恭城| 田东县| 福安市| 融水| 彭泽县| 礼泉县| 宝应县| 连城县| 永修县| 五华县| 曲靖市| 长海县| 正阳县| 屏边| 德惠市| 亳州市| 黎川县| 耒阳市| 甘孜县| 乃东县| 易门县| 雅江县| 彝良县| 义马市|