27 Star 81 Fork 11

lunny/tango

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
prefix.go 419 Bytes
一键复制 编辑 原始数据 按行查看 历史
lunny 提交于 2015-05-25 10:44 +08:00 . small optimization
// Copyright 2015 The Tango Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tango
import (
"strings"
)
// TODO: regex prefix
func Prefix(prefix string, handler Handler) HandlerFunc {
return func(ctx *Context) {
if strings.HasPrefix(ctx.Req().URL.Path, prefix) {
handler.Handle(ctx)
return
}
ctx.Next()
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/lunny/tango.git
git@gitee.com:lunny/tango.git
lunny
tango
tango
v0.5.0

搜索帮助