如何调试 Gin Web Framework
how to debug Gin Web Framework
我正在为 REST API 使用 Go gin。在 ruby 上的 rails 应用程序中,我可以使用调试器或 pry 进行调试。我怎样才能在 gin 框架中做同样的事情?
已编辑:
考虑以下请求。
curl -X GET localhost:5005/test_controller/test_action --data '{ "sw_lat" : 83.4444, "sw_lon" : -171.232323, "ne_lat" : 82.2323232, "ne_lon" : -161.3434343}' -H "Content-Type:application/json"
Ruby 在 Rails:
要检查服务器中的上述请求,我可以像下面这样放置 debugger
。
def test_action
debugger
end
使用 rails s
启动服务器并命中请求后,服务器将暂停在调试器行中。它可以让我检查一些东西。
开始:
dlv debug
不启动服务器。所以我不能点击并检查上面的请求。帮助我设置断点并在服务器 运行.
时进行调试
您可以使用 Delve debugger either through the command line or with the editor integrations.
Gin 还有记录器和恢复中间件,应该足以诊断基本路由问题等。
我正在为 REST API 使用 Go gin。在 ruby 上的 rails 应用程序中,我可以使用调试器或 pry 进行调试。我怎样才能在 gin 框架中做同样的事情?
已编辑: 考虑以下请求。
curl -X GET localhost:5005/test_controller/test_action --data '{ "sw_lat" : 83.4444, "sw_lon" : -171.232323, "ne_lat" : 82.2323232, "ne_lon" : -161.3434343}' -H "Content-Type:application/json"
Ruby 在 Rails:
要检查服务器中的上述请求,我可以像下面这样放置 debugger
。
def test_action
debugger
end
使用 rails s
启动服务器并命中请求后,服务器将暂停在调试器行中。它可以让我检查一些东西。
开始:
dlv debug
不启动服务器。所以我不能点击并检查上面的请求。帮助我设置断点并在服务器 运行.
您可以使用 Delve debugger either through the command line or with the editor integrations.
Gin 还有记录器和恢复中间件,应该足以诊断基本路由问题等。