Git Product home page Git Product logo

Comments (5)

zensh avatar zensh commented on August 12, 2024 1

There is Otherwise mathod on your demand

from trie-mux.

zensh avatar zensh commented on August 12, 2024

It can't support implicit matching.

You should define router.Get("/a", handler)

from trie-mux.

cssivision avatar cssivision commented on August 12, 2024

In my opinion, simple pattern take precedence over named pattern, /a conflict with /:a, if both of them exist, maybe there should be a panic.

There is other situation

package main

import (
    "net/http"
    "github.com/teambition/trie-mux/mux"
)

func main() {
    router := mux.New()
    router.Get("/a/b", func(w http.ResponseWriter, _ *http.Request, _ mux.Params) {
        w.Write([]byte("hello world!\n"))
    })

    router.Get("/:name/b", func(w http.ResponseWriter, _ *http.Request, _ mux.Params) {
        w.Write([]byte("index\n"))
    })

    http.ListenAndServe(":8080", router)
}

/a/b is conflict with /:name/b, path /b/b match /:name/b, but it's difficult to find the conflict between them, i can't solve this, so i post a issue.

from trie-mux.

zensh avatar zensh commented on August 12, 2024

Currently it is enough for practice usage with high performance. Don't make logic intricacy.

from trie-mux.

cssivision avatar cssivision commented on August 12, 2024

Yes, beyond is as wrong as falling short.

from trie-mux.

Related Issues (1)

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.