go-pkgz / routegroup Goto Github PK
View Code? Open in Web Editor NEWLightweight library for route grouping and middleware integration with the standard http.ServeMux
Home Page: https://go-pkgz.umputun.dev/routegroup/
License: MIT License
Lightweight library for route grouping and middleware integration with the standard http.ServeMux
Home Page: https://go-pkgz.umputun.dev/routegroup/
License: MIT License
Currently, each handler is wrapped individually with middleware, offering a relatively simple implementation. However, this approach has a limitation: it doesn't allow the registration of middleware that acts on both registered and unregistered routes. While this might not pose a problem in most cases, there are situations where we might want a general middleware, such as for logging, to act on all routes.
A more appropriate solution would be to apply middleware at the group level rather than on each individual route. However, all the solutions I have explored so far have been complex and introduced a significant amount of non-intuitive code.
An alternative solution is to implement a "catch-all" handler for not-found cases on the root ("/") path, but only if no other root path has already been registered. Although this approach may seem unconventional, it offers a straightforward implementation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.