hilla
hilla copied to clipboard
Support Mono in addition to Flux
Is your feature request related to a problem? Please describe. Sometimes it makes more sense to use a Mono than a Flux, e.g. when you fetch one item from a DB. Mono<T> return values should be supported from endpoint methods.
Describe the solution you'd like
I think we should support a Mono<T> return value from endpoints so that the browser side API is the same as when the method returns T, i.e. returns a promise for T | undefined. It will then be different from Flux but that is the whole point of having Mono in the first place
I’m wondering if Mono<T> should translate to Promise<T> in TypeScript? 🤔
Are you wondering if it is good or bad that it would be Promise<T>?
To me it sounds like a Mono<T> is used in an endpoint primarly/only for Java reasons and in TS you only care about the value (or a thrown exception)