-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add middleware concept for addons. #1097
Conversation
/cc @bcardarella |
secondCalled = true; | ||
} | ||
}, { | ||
doesntGoBoom: null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To confirm that an addon that does not implement a serverMiddleware method does not throw an error.
@rjackson correct me if I'm wrong but this implementation would only allow manipulation of other addon's middleware order. If that is the case does this mean having to change the existing middleware in ember-cli to be addons? |
do we need to use a dag to specific the order? like ember initializers? If so we can just lift Ember.DAG and use it here. |
Yes, I believe that we will need to, but plan on adding it across the board in a later PR (likely just in the Project.prototype.initializeAddons function). I think this will service all of our various plugins better (since it is conceivable that even an asset based plugin will need to be added after or before another). |
Is there a way to access the options from the addons? |
@WMeldon - Updated to provide options to addons. @stefanpenner - This look good to you? |
LGTM |
* Refactors express server to explicitly start the http server. This was what it does naturally, but we need access to the raw server to be able to teardown the server between tests. * Refactor express server to make it a bit more testable. * Add `addon.serverMiddleware` callback function. The addon is called with the instance of the express app. * Refactor `api-stub` blueprint (and expected API) so that the express app is started in a consistent way. Prior to this, if you had a `./server/` folder, your code would create the `express` app add the `ember-cli` middleware.
Add middleware concept for addons.
we will need to consider ordering of these (and other addon injected things) So when some addons have ordering constraints we can consider a DAG or some other mechanism. |
I am working up a PR that adds the DAG stuff from Ember. I plan on implementing it to the |
what it does naturally, but we need access to the raw server to be
able to teardown the server between tests.
addon.serverMiddleware
callback function. The addon is calledwith the instance of the express app.
api-stub
blueprint (and expected API) so that the expressapp is started in a consistent way. Prior to this, if you had a
./server/
folder, your code would create theexpress
app add theember-cli
middleware.Closes #1086.