Coder Social home page Coder Social logo

issue9 / mux Goto Github PK

View Code? Open in Web Editor NEW
50.0 7.0 7.0 1.45 MB

适用第三方框架实现可定制的路由

Home Page: https://pkg.go.dev/github.com/issue9/mux/v8

License: MIT License

Go 100.00%
golang go mux router options restful restful-api rest-api http-router middleware

mux's People

Contributors

caixw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mux's Issues

精简method的方法

Method包含了普通的Add()AddFun()方法,及与之对应的Must*()方法,
Must*()系列方法在碰到错误时,直接panic,而不像其它方法一样返回错误信息。
是否可以将Must*()系列方法独立出来:

type ErrorMethod struct {
    m     *Method
    errs []error
}

fumc (m *ErrorMehtod) Add(pattern string, h http.Handler, methods ...string)  *ErrorMehtod {
    err := m.m.Add(pattern, h, methods...)
    if err != nil {
        m.errs = append(m.errs,err)
    }

    return m
}

添加对相同路由项的检测

比如:

/posts/{id1:\\d+}.html
/posts/{id2:\\d+}.html

这类仅参数名称不同,但是正则相同的路由,第二第加入的是始终无法路由到的。在添加时应该做一些检测。

去掉Matcher接口

多数情况下,让人无法判断到底是哪个handler处理相关的请求

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.