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

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.

主站蜘蛛池模板: 工布江达县| 通道| 新津县| 高台县| 屏东县| 千阳县| 高陵县| 大英县| 南丹县| 安顺市| 新宁县| 平邑县| 黄山市| 南宫市| 安康市| 中江县| 通辽市| 双江| 汉沽区| 自贡市| 连江县| 方正县| 九寨沟县| 合作市| 柳州市| 盘山县| 日照市| 饶阳县| 香河县| 介休市| 常宁市| 满城县| 阿鲁科尔沁旗| 东宁县| 灵宝市| 阆中市| 天柱县| 会同县| 错那县| 独山县| 商南县|