Giter Site home page Giter Site logo

Support both Alice and Negroni about handlers HOT 8 CLOSED

doug avatar doug commented on May 7, 2024
Support both Alice and Negroni

from handlers.

Comments (8)

kisielk avatar kisielk commented on May 7, 2024

I'm not really sure what you're asking. Is it to change the way the handlers are constructed? or?

from handlers.

doug avatar doug commented on May 7, 2024

Yes, I'm referring to the construction. I'm saying if the struct supported func ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) you could also expose func(http.Handler)http.Handler using something like the Compose function I wrote above. Then both are available.

from handlers.

doug avatar doug commented on May 7, 2024

I'm happy to create a pull request illustrating the idea if you think it prudent.

from handlers.

kisielk avatar kisielk commented on May 7, 2024

I'd prefer if everything in the package stuck to the standard http.Handler API. There's a lot of people going in different directions with approaches to implementing middleware with none of them being the clear winner yet. At least net/http is a common denominator.

from handlers.

doug avatar doug commented on May 7, 2024

Totally reasonable. I actually think the http.Handler -> http.Handler is the nicest api unless something different gets added to net/http. I would like the community to standardize, but I'm sure it will with time. Do you have a list somewhere of handlers people should be writing?

from handlers.

kisielk avatar kisielk commented on May 7, 2024

Not really. I've just included ones I've used in my web applications and found to be generally useful, and a few others which users of the package have submitted.

from handlers.

doug avatar doug commented on May 7, 2024

Cool, might be nice to have a roadmap on the wiki or readme of handlers for people to consider writing. For example, I have some caching handlers I use (browser cache, lru cache, memcache) I wrote which I could convert to this format if that is of interest.

from handlers.

kisielk avatar kisielk commented on May 7, 2024

I don't really have a particular roadmap or vision beyond "a useful collection of http.Handler types" so if you think you have something useful just propose it :)

from handlers.

Related Issues (20)

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.