Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Question] app.configure without scope? #558

Closed
cpsubrian opened this issue Apr 20, 2017 · 5 comments
Closed

[Question] app.configure without scope? #558

cpsubrian opened this issue Apr 20, 2017 · 5 comments

Comments

@cpsubrian
Copy link

cpsubrian commented Apr 20, 2017

Since I'm fairly new to using feathers, I was wondering the philosophy behind the pervasive use of scope in various parts of the API. I used to design APIs this way as well but lately have preferred more functional/explicit designs.

For example:

function myPlugin (options) {
  return function () {
    var app = this
  }
}
app.configure(myPlugin({}))

vs.

function myPlugin (options) {
  return function (app) {}
}
app.configure(myPlugin({}))

I understand that it would be a huge breaking change (and thus probably not realistic), but at least in this case it could be changed in a backwards compatible way (but other things like hooks and services are tricker).

@marshallswain
Copy link
Member

There's a comment about this in the code: https://github.com/feathersjs/feathers/blob/master/src/application.js#L110

@daffl
Copy link
Member

daffl commented Apr 20, 2017

This was how Express used to do it. It wouldn't be a huge change to additionally pass the app as an argument.

@cpsubrian
Copy link
Author

@daffl Indeed, and I could easily override with my own version that does this ... was more just curious if it was a core API design opinion.

@daffl
Copy link
Member

daffl commented Oct 29, 2017

This has been added in v3 (see linked PR)

@lock
Copy link

lock bot commented Feb 7, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants