-
Notifications
You must be signed in to change notification settings - Fork 284
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
added Json handling and @contentType UDA #684
Conversation
@s-ludwig what do you think about this API addition ? |
The REST and web modules have different scopes. The REST module in particular is meant to provide a full RPC mechanism, if needed, and is supposed to enforce a stateless protocol. The web module on the other hand is strongly related to session and HTML based interfaces. In theory, JSON seems to fit more with the REST module, but of course there are many use cases for non-REST JSON, too. The functionality itself is fine, IMO. I just have a few thoughts left to be sorted out:
|
I think the lost return value can be avoided with a simple UDA |
I added the possibity to use |
Do you have a use case for returning a Regarding the return value and |
|
It is used like this
|
That doesn't seem to buy much over
I'd rather add specific support for web sockets than to litter the API with such special cases to achieve something with a handful of less characters to type. It will make everything harder to understand (the general web.web concept is already quite non-obvious due to the declarative nature, I think it should be kept as small as possible). |
IMO It does not really affect the API as such. |
I don't where this is too complicated ... maybe I'm overlooking something here .. |
If you see code like that and don't know this special rule, you can just wonder what happens. It's not this particular feature, but if this becomes a kitchen sink of little mini-helpers and rules, then the source code of applications written with this can become impenetrable. It also facilitates bad code, such as:
This will create a new heap delegate for every request, which may have considerable performance impact. So to support something like that, I'd rather support it in a way that forces an efficient approach. |
hmm I get the efficiency-argument. |
The most intuitive way to me seems to be supporting the same signature as
The web interface generator can then pass that to |
hmm, |
Would be very welcome, if you implement that. A rebase of your branch would also be good (ideally skipping the two |
Thanks for rebase. I'll merge now, so that the WS additions are separate. |
Add Json handling and @contentType UDA + an alias for WebSocket handler delegates.
this change adds the possibility to serve arbitrary data (if convertable to
ubyte[]
) with a customcontentType