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

Running the code

Let us fire a CURL request and see what the response is for various routes:

go run customMux.go

Now, fire up a shell or browser to see the server in action. Here, I use the CURL request:

curl -X GET http://localhost:8000/

The response is:

Your random number is: 0.096970

Use Ctrl + C or Cmd + C to stop your Go server. If you are running it as a background process, use pgrep go to find the processID and kill it using kill pid.

主站蜘蛛池模板: 紫阳县| 吉林市| 武威市| 蕉岭县| 高唐县| 花莲县| 兰西县| 霍山县| 平利县| 伊吾县| 平原县| 大安市| 高陵县| 普宁市| 屏南县| 彩票| 肇东市| 绥中县| 岑巩县| 卓资县| 罗定市| 巴彦淖尔市| 三穗县| 兖州市| 阳城县| 定日县| 宜宾市| 盐边县| 从化市| 六枝特区| 五原县| 志丹县| 兴业县| 翁牛特旗| 乡宁县| 南昌市| 兴安盟| 农安县| 台州市| 西充县| 揭东县|