我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

在水牛城里反向路由

Is there any possibility to use a reverse router, e.g. similiar to the Play framework? This would be helpful in order not to hardcode URLs outside the app.go.

In app.go use Name() to define a name for the route (as in mux). For example:

auth.GET("/{provider}", bah).Name("login")

buffalo will however append "Path" to it and make it available as

loginPath({key : value})

for example:

<a href="<%= loginPath({provider: "github"}) %>">login</a>

近期文章

  • 执行数小时后,go程序在semacquire问题上系统崩溃
  • 如何调试特定功能?
  • 在HTML页面上使用Golang进行实时搜索
  • 在导入的结构上覆盖结构字段标签
  • 如何在Go中合并类似的多包项目
  • 在方法或构造函数级别没有处理?
  • Intellij如何设置默认调试端口
  • 超时长时间运行的cgo函数调用
  • 如何通过go例程连接多个切片
  • 如何在不共享bufio.Scanner的情况下反复从os.Stdin中读取
  • 为什么不填充此HTTP请求的“响应”字段?
  • 用于遍历地图的Golang不会返回不一致的值[重复]
  • 处理模型特定操作与数据库操作
  • Node.js / Golang AES 256解密
  • Golang AWS Xray.sql错误
  • GCC在构建时未定义的引用
  • CPU /未在core.v1.Pod.PodSpec中填充的内存量
  • 如何使用gonum / go制作具有复杂数字条目的矩阵?
  • 使用代理时去泄漏goroutines
  • 通过JSON-RPC调用传递身份验证详细信息

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华