What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi everybody, since there are often questions in our teams when it comes to asynchronous calls from

UPWG9AYH2
UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet

Hi everybody,
since there are often questions in our teams when it comes to asynchronous calls from yves frontend to the zed backend (using ajax etc.) … “glue” is meant almost everytime and i am a bit unsure now^^
Does it make sense to involve the glue API here when we use yves general but want to make some of the parts of the page async loaded? For my understanding, when we use yves anyway it would make sense to stick to a controller in yves to render json for the frontend. Just to be sure: are there any cases/experiences when it make sense to involve the glue API? For my understanding not really, since glue is at the same level as yves on architecture, it should not be “mightier” than the yves framework, or am i completely wrong? In case of a product detail page for example i would render just json with the data that is required in the frontend instead of the whole html … on the other side, glue does have a “standardized” request/response flow which i can imagine would be easier to implement … any experiences here?
Best regards

Comments

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    for what I know, glue is more for separate apps (eg mogile app, or single page application frontend). If you are using yves and doing just "API" calls for the "yves part" json, then they should be still in the yves

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet
    edited March 2021

    I think i asked similar question some time ago and one of the Spryker architects responded with similar answer

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet

    yeah, thats the question … i mean i could also do a SPA completely rendered in yves … so just some kind of index controller would provide the SPA and the data is fetched via other controllers …
    I was just wondering if glue is in some way more advanced than yves since it already provides data in the way, some external app would prefer it … while in yves we have to do a lot more than in glue. But as i said, in the moment i don’t see any advantages

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet

    thanks a lot for your answer 😉

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    if you use Yves already as a frontend - then use it for ajax queries as well. Glue - is a separate Application to be taken care of. From infrastructure and maintenance perspective that’s a bit of an overkill for your case IMO

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet

    Yes okay, so my feelings were still right, but just wanted to proof it. Thanks for your answers 🙂 Have a nice day!

  • U018G5AQ5PS
    U018G5AQ5PS Posts: 5 🧑🏻‍🚀 - Cadet

    @UKJSE6T47 To be concrete: We would like to have a controller for the product detail page that returns the product once as HTML and once as JSON. Do you have any ideas on how we can best implement this?

    We currently see three possibilities:
    1: Logic in the ProductDetailController that returns either HTML or JSON based on the "Accept" header. (Simple if-block)
    2: A stand-alone parameterised controller that accesses the Redis and than doing the same stuff like the ProductDetailControllers.
    3: An additional URL for each product, with a matching ResourceCreatorPlugin and a controller that returns just JSON.

    Do you see another possibility?

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    could be also
    4: another action of the ProductDetailController that would return you the json..
    Any option would do, I’m not sure I understood the 3rd one, but I think it’s enough to have 1, 2 or 4

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet
    edited March 2021

    As far as i see the corresponding ProductDetailPageResourceCreatorPlugin does only allow one action … or how to add another action for the same controller using the ressourcreatorplugin? 🤔

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    ah, sorry, I meant the ProductController . We used the approach I mentioned above in an older version of Spryker, maybe that won’t work through ProductDetailPageResourceCreatorPlugin.

  • U018G5AQ5PS
    U018G5AQ5PS Posts: 5 🧑🏻‍🚀 - Cadet

    Thank you for your Feedback, @UKJSE6T47