You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I refuse to do this until I'm happy with how you define such a thing, but it would be useful for cutting down boilerplate code and everything we have now could be built on top of this, so I'm going to start brainstorming here :).
While what we have right now is not really an issue, one might typically do something like the following:
I can see this getting out of hand quite quickly though, and if users dont abstract out the callbacks to some other file and try to define them inline along with .get() / .use() etc it will look like hell. Another problem is that for an API like above, without having an explicit zero-arg .end() like jQuery we need an explicit end-point callback, though we can treat it as middleware internally. This method might look like this:
.end=function(fn){this.use(fn);returnthis.pop();}
with this change the param callbacks could easily be normalized as well:
reality is with what we have now, you can create the second api, or with the second api you can create the first api haha. so it doesn't really matter but it's worth looking into a bit more since it would make things a bit easier for express-resource and friends.
I refuse to do this until I'm happy with how you define such a thing, but it would be useful for cutting down boilerplate code and everything we have now could be built on top of this, so I'm going to start brainstorming here :).
While what we have right now is not really an issue, one might typically do something like the following:
Internally this would be easier to manage with the following representation, but useful as a public API as well.
I can see this getting out of hand quite quickly though, and if users dont abstract out the callbacks to some other file and try to define them inline along with
.get()
/.use()
etc it will look like hell. Another problem is that for an API like above, without having an explicit zero-arg.end()
like jQuery we need an explicit end-point callback, though we can treat it as middleware internally. This method might look like this:with this change the param callbacks could easily be normalized as well:
internal representation:
and:
would be equivalent to:
we could go further and take
.del(callback)
etc to be equivalent to.del().end(callback)
.The text was updated successfully, but these errors were encountered: