Quantcast
Channel: Customized Commerce 13 and earlier versions
Viewing all articles
Browse latest Browse all 9642

Optimizely Graph - best practices for business logic?

$
0
0

I am building a headless website in CMS12 and the new Optimizely Graph.

When building a traditional MVC website we had the power of C# and the powerful Episerver SDK at our disposal within the page controllers, so that we can apply business logic and filtering, before passing data to the frontend. 

For example, let's say I want to fetch the website navigation with a simple GraphQL query, for rendering on the frontend

{
  ContentPage(where: {VisibleInMenu: {eq: true}}) {
    items {
      Name,
      Url
    }
  }
}

That all works fine, however, if I'm building a mega-menu in the frontend for example, I need to to know what pages are "top-level", and what pages sit underneath each item. In a traditional architecture I would construct a ViewModel with this information in the controller, however, we don't have that capability with Optimizely Graph.

So my question is, for this scenario, what is the best practice to tackle it?

- Do I include the page children in the request and delegate the filtering to the frontend?

- Or is there a way to add custom resolvers? I couldn't see it in the docs, but if not, are there plans for this, or any plans to give us more server-side control?

Thanks


Viewing all articles
Browse latest Browse all 9642

Trending Articles