Skip to content
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

rewrite Handlers and @register #668

Closed
ExpandingMan opened this issue Jan 28, 2021 · 3 comments
Closed

rewrite Handlers and @register #668

ExpandingMan opened this issue Jan 28, 2021 · 3 comments
Labels
api changes server About our HTTP server

Comments

@ExpandingMan
Copy link

ExpandingMan commented Jan 28, 2021

The HTTP.Handlers and HTTP.Router functionality is extremely useful, but the way the handler code is written is extremely limiting. In particular, since routers must be defined using the @register macro, and these define a bunch of new methods, routers essentially need to be declared and set up in global scope. This is inappropriate for what is likely to be the majority of use cases for this, in which the router is likely associated with some other data structure and may need to be created with highly configurable routing. Furthermore, as far as I can tell there is no reason why the routing need involve any macros. Lambda functions should more than suffice. Fortunately, this doesn't exactly involve a ton of code, but it probably would involve a ton of testing and documentation.

I'm not at all sure I'd want to take this on myself, but if I did, would a rewrite be something everyone would be receptive to? Otherwise, probably worth keeping up this issue for discussion in case somebody wants to take it on at a later date.

@willemhb
Copy link

Having this exact same issue with Routers. It seems like Routers should be useful for breaking out endpoints into modules, but this is only really possible by playing incredibly fast and loose with globals variables.

@fonsp fonsp added server About our HTTP server api changes labels Mar 16, 2022
@fonsp
Copy link
Member

fonsp commented Mar 16, 2022

(Also see #658)

@quinnj
Copy link
Member

quinnj commented May 25, 2022

Fixed via #818

@quinnj quinnj closed this as completed May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api changes server About our HTTP server
Projects
None yet
Development

No branches or pull requests

4 participants