[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in"debug" mode. Switch to "release" mode in production. - using env: export GIN_MODE=release - using code: gin.SetMode(gin.ReleaseMode) # 注册的路由如下 [GIN-debug] GET /v1/user/login --> go-use/practise.TestRouteGroup.func1 (3 handlers) [GIN-debug] GET /v1/user/register --> go-use/practise.TestRouteGroup.func2 (3 handlers) [GIN-debug] GET /v1/user/del --> go-use/practise.TestRouteGroup.func3 (3 handlers) [GIN-debug] GET /v2/user/login --> go-use/practise.TestRouteGroup.func4 (3 handlers) [GIN-debug] GET /v2/user/out --> go-use/practise.TestRouteGroup.func5 (3 handlers) [GIN-debug] Environment variable PORT is undefined. Using port :8080 by default [GIN-debug] Listening and serving HTTP on :8080
3.3、请求返回
1 2 3 4 5 6 7 8 9 10 11 12
[lepeng@centos ~]# curl -X GET http://127.0.0.1:8080/v1/user/login {"msg":"v1-登录成功"} [lepeng@centos ~]# curl -X GET http://127.0.0.1:8080/v1/user/register {"msg":"v1-注册成功"} [lepeng@centos ~]# curl -X GET http://127.0.0.1:8080/v1/user/del {"msg":"v1-注销成功"} [lepeng@centos ~]# curl -X GET http://127.0.0.1:8080/v2/user/login {"msg":"v2-登录成功"} [lepeng@centos ~]# curl -X GET http://127.0.0.1:8080/v2/user/out {"msg":"v2-用户退出"} [lepeng@centos ~]# curl -X GET http://127.0.0.1:8080/v2/user/del 404 page not found
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in"debug" mode. Switch to "release" mode in production. - using env: export GIN_MODE=release - using code: gin.SetMode(gin.ReleaseMode) # 注册的路由如下 [GIN-debug] GET /api/user/login --> go-use/practise.TestRouteGroupNested.func1 (3 handlers) [GIN-debug] GET /admin/user/login --> go-use/practise.TestRouteGroupNested.func2 (3 handlers) [GIN-debug] Environment variable PORT is undefined. Using port :8080 by default [GIN-debug] Listening and serving HTTP on :8080
4.3、请求返回
1 2 3 4
[lepeng@centos ~]# curl -X GET http://127.0.0.1:8080/api/user/login {"msg":"api-登录成功"} [lepeng@centos ~]# curl -X GET http://127.0.0.1:8080/admin/user/login {"msg":"admin-登录成功"}