Comments (2)
So the final draft of the design is as follows:
We are going to have handlers array inside the gearbox object which will contain all app-level handlers.
we are gonna have handlers in the context as well and index of the current handler
and finally handlers in the registered routes tree.
they are all arrays of functions where the main handler is the last one.
all the routing methods ( get, post, and etc ) will accept multiple handlers instead of one handler.
basically the application gets a request matches it and executes the first handler which if passed will execute C.Next() and if failed will just respond with an error.
we keep the index inside the context as well as the handlers array and each Next call increases the index.
Having the first middleware as the first element in the context and the main handler as the last one.
The tree node will be the same except for the handler part it would-be handlers.
During the execution Context will have the App-level handlers/middlewares at the beginning of the handlers array then the original routing handlers/middlewares then the actual handler that will have the business logic normally.
from gearbox.
I can do this one.
from gearbox.
Related Issues (20)
- Datadog support APM
- Prometheus middleware HOT 2
- CORS support HOT 1
- broken link to your docs HOT 1
- Add a render method to the context interface. HOT 1
- Is this project alive? HOT 3
- can you remove virus link from project description? HOT 1
- gogearbox.com is a redirect to malware filled ads HOT 1
- Introduce an implementation for workers in Gearbox HOT 2
- SSL support. HOT 3
- Add validation for max params count and request url length HOT 1
- Improve current router implementation HOT 1
- Automatically handle OPTIONS request made by browsers HOT 1
- wrap standard net/http handler HOT 2
- my ubuntu i686 system get the wrong result HOT 10
- Pass data from middleware to handler HOT 2
- Participate in the Tech Empower benchmark HOT 2
- runtime error: slice bounds out of range [1:0] HOT 2
- add embed example for go 1.16 HOT 1
- Set custom error handlers HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gearbox.