GithubHelp home page GithubHelp logo

gorilla / pat Goto Github PK

View Code? Open in Web Editor NEW
151.0 13.0 24.0 68 KB

Package gorilla/pat is a pretty simple HTTP router for Go.

Home Page: https://gorilla.github.io

License: BSD 3-Clause "New" or "Revised" License

Go 89.64% Makefile 10.36%
golang gorilla go gorilla-web-toolkit http router

pat's People

Contributors

apoorvajagtap avatar coreydaley avatar elithrar avatar garyburd avatar kisielk avatar mbanzon avatar moraes avatar rtfb avatar ryanslade 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  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  avatar  avatar  avatar  avatar  avatar  avatar

pat's Issues

Nice path prefixing?

On initial inspection I don't see an elegant way to use pat with a path-prefixed Subrouter. Do I ditch pat and just go straight mux at this point?

handle query parameter

How would define a route for /api/things?a=1
router.Get("/api/things?a={id}", getAllTheThings)

Use stdlib context on Go 1.7+

Currently, gorilla/pat relies on gorilla/context, but since Go 1.7 that is actually not needed. I would like to propose that for Go 1.7+, gorilla/pat should use the native context package, just like gorilla/mux did: https://github.com/gorilla/mux/blob/master/context_native.go

The problem is that gorilla/pat would rely only on the contextClear func, that currently is a no-op on the native implementation. We could implement contextClear to set the request context as a fresh context.Backgroun().

Would a PR for this be acceptable?

Getting a Pat subrouter

Hi,

I use a mux.Router to handle top level path handling in my app,
and I'd like to use pat.Router for second-level path handling.
So I'd like to get a pat.Router as subrouter of a mux.Router.

Something like :

r := mux.NewRouter()
articles.Register(r.PathPrefix("/articles").Subrouter())

And in articles package:

func Register(r *pat.Router) {
    r.Get("/{id}", read)    
}

Implement HTTP PATCH

In REST-like API, PUT should only be used if you're replacing a resource in it's entirety.

According to RFC 5789:

Several applications extending the Hypertext Transfer Protocol (HTTP) require a feature to do partial resource modification. The existing HTTP PUT method only allows a complete replacement of a document. This proposal adds a new HTTP method, PATCH, to modify an existing HTTP resource.

Create a semver tag

The current tag is not following the semver principle. It would be great to tag it 1.0.0 for golang modules usage.

KeepContext is not respected

When handling requests the KeepContext field is not respected (unlike in the mux package) and context is .Clear(req)'ed on every request.

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.