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
{{ message }}
This repository was archived by the owner on Dec 21, 2021. It is now read-only.
Hello,
Thank you for this well explained demo of Lucid.
I have a question regarding RespondWithJsonJob and RespondWithViewJob.
If my feature should serve both API and Web Controllers. They have exactly the same logic except for the last line which returns either JSON or a view.
What is your recommended solution here?
I am thinking about creating a Middleware where I inject into the Request object a value (e.g. source [WEB, API]) which determines whether the request is an API or Web.
And then inside the feature, I have two options:
Create an Operation e.g. RespondOperation, that takes the source variable, and based on that, it will run either RespondWithJsonJob or RespondWithViewJob.
Add if; else inside the feature to determine which response job based on the source.