6 ms·
export class TaskController extends Controller { @use(StoreTaskRequest) store(request: StoreTaskRequest): void { const descriptio
by activitypea 4y ago
export class TaskController extends Controller {
@use(StoreTaskRequest)
store(request: StoreTaskRequest): void {
const description: string = request.get('description')
}
I've done enough Spring Boot to know I never want to do Spring Boot in my life again.
- _madmax_ 4y agoI share the hate.
- racked 4y agoHelp me out here, what does that bit of JS have to do with Spring Boot?
- dextreem 4y agoProbably that @use thing?
- dmalvarado 4y agoMagic decorators is the trigger, I think.
- simlevesque 4y agoYeah, decorators were a mistake. I don't want any in my code or my dependencies.
- popotamonga 4y agoWhy does it need the use if its already a parameter?
- eurasiantiger 4y agoIt’s a dependency injection pattern. The decorator is telling some other piece of code what to pass in to that method, or to set some hidden context. I’d check the docs for what it specifically does, but the site is completely unusable on iOS.
- rswskg 4y agoIt would make more sense if the injected variable was an interface, the decorator telling you what the concencrete type should be. I think? Otherwise, yeah totally pointless.
- donaldpakkies 4y agoSo this is only meant for DI, and the main benefit is request validation. You could also opt to use the controller's validation helper if you don't want to use the `@use` decorator.