-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved Middlewares #59
Conversation
61db89a
to
c8865c9
Compare
Cool! So what I'd like to to with middleware/ hooks is
|
In the next version of middlewares, I am trying to run all middlewares in the same eventloop. That means, you can't use "next()" asynchronously and wait the router. If you don't call "next()" we will call it after the middleware function runs. This is a step to move all the logic into template layer or something else. But not in the router. So, now biggest question will be how to deal with login checks and so on. I am planning implement a basic set of Blaze helpers and a set of Apis to do it in the template layer. It's won't be something in the router. It's a seperate package. |
@zimt28 for your second point, I don't think router need to implement it. |
@arunoda Have you already began working on it? As always, I'm willing to help. |
Sure. Thanks. Just brainstorming here. Didn't start. I'll make an open On Tue, Apr 21, 2015 at 10:23 AM Delgermurun Purevkhuu <
|
Document is good idea. |
Let's do it. @arunoda Can you write document? Including API syntax etc... If you permit, I would like to implement the proposal :). |
Okay sure. I will do it in few hours :)
|
@arunoda Please rebase this branch as well. |
yeeeey, today is a great day. with the before/after middleware, the router will be a complete replacement for IR. @arunoda just a proposal, maybe we can stick with middleware name, in many frameworks it is named so. triggers are kind of db stuff ;) |
I'm okay with any name. If we call it middlewares, people except it to be work like a middleware in On Wed, May 27, 2015 at 9:18 AM Vlad Shcherbin notifications@github.com
|
@arunoda sure, any name would be nice then. Can't wait to see the new api and usage examples. Thank you guys for you work! |
c8865c9
to
78dbfa9
Compare
@delgermurun check the PR description. I updated how the API should looks like. |
@arunoda Thanks. I'll do prototype shortly. |
Awesome. |
Triggers are alive: https://github.com/meteorhacks/flow-router#triggers |
I just updated and am trying to implement triggers. Doesn't it make sense though to have that in there? If this moves into template logic, that means I need to repeat myself with each template... I guess I can wait to see how it plays out. By the way, thanks for the great work on everything you've contributed! |
Arunoda, I have middlewares like this middlewares: [function (path, next) {
next(!Groups.can('see_something') && '/home');
}] What do I do now? |
See: #153 |
is it possible to feed the 'name' of a route group into the 'except' array? |
Read this first #57
Middlewares are pretty important and we can have some good API for middlewares. In this PR. We can have these.
API
For individual routes
For all routes
We can't have both
only
andexcept
at once.