Giter VIP home page Giter VIP logo

2022-e-square-v's Introduction

Hackathon Logo

Team name

⟹ E-Square-V

Category

⟹ Best addition to the Sitecore MVP Site

Description

⟹ This work will introduce some additional Foundation Layers to the Sitecore MVP site that connects with Sitecore Experience Edge to fetch the Layout Response data. The Sitecore Experience Edge is a futuristic API based Service from Sitecore and its replicated and scalable. Currently the Sitecore MVP Site does not offer to use Experience Edge with GraphQL queries to fetch the layout route data of the pages.

This project will enable the Sitecore MVP Site to connect with Sitecore Experience Edge with the help of the CustomRenderingEngineMiddleware and CustomGraphQLEdgeConnector layers.

How does this module solve it ?

The below two additional foundation layers have been introduced to achieve this.

  • CustomRenderingEngineMiddleware
  • CustomGraphQLEdgeConnector

The new Foundation Layers in the Mvp-Site solution as below,

Solution Update

The following diagram summerizes the current behaviour verus the new approach with Sitecore Experience Edge.

👉 Current Approach with JSS Sitecore Layout Service

Existing Approach

👉 New Approach with Sitecore Experience Edge

New One

Video link

🏆 ⟹ ⟹ Video demo

Presentation

💾 ⟹ ⟹ Presentation Deck

Pre-requisites and Dependencies

📢 Installation instructions

Note

  • Always use an elevated/Administrator Windows Powershell 5.1 to run the commands

Steps

  • Please make sure the IIS is stopped
  • Run the below Powershell command to prepare the environment. It will take care of adding host entries and creates wildcard certificates
    .\init.ps1 -InitEnv -LicenseXmlPath "[Path to the license folder]\license.xml" -AdminPassword "DesiredAdminPassword"
  • It would have added the below host entries,

    • mvp-cd.sc.localhost
    • mvp-cm.sc.localhost
    • mvp-id.sc.localhost
    • mvp.sc.localhost
  • In the .env the Okta developer account details must be populated.

    • OKTA_DOMAIN (must include protocol, e.g. OKTA_DOMAIN=https://dev-your-id.okta.com)
    • OKTA_CLIENT_ID
    • OKTA_CLIENT_SECRET
  • After completing this environment preparation, run the startup script from the solution root:

    .\up.ps1
  • It will prompt for the login to sitecore. Login and accept the device verification

  • Wait for the script to complete and open the CM, CD and rendering host sites

  • To Stop the environment again

    .\down.ps1

Configuration

⟹ No further configuration needed

📢 Usage instructions

To make the RenderingEngineMiddleware to use the CustomHttpRequestHandler

  • In the startup.cs file of the RenderingHost, we need to comment out the default request handler and configure our customlayoutrequesthandler like below.

Startup configuration

App Setting Configuration in the Rendering Host

  • In the rendering host appsettings.config file, you need add the below configuration changes for the CustomRenderingEngine Middleware to use Sitecore Experience Edge and for the GraphQLEdgeConnector
  "Foundation": {
    "GraphQLEdgeConnector": {
      "GraphQL": {
        "UrlLive": "http://cm/sitecore/api/graph/edge",
        "UrlEdit": "http://cm/sitecore/api/graph/edge",
        "BypassRemoteCertificateValidation": true
      }
    },
    "Middleware": {
      "EndpointConfiguration": {
        "UseExperienceEdgeEndpoint": "true"
      }
    }
  }

Comments

❓ How does it work ?

  1. The user visits the Sitecore MVP site
  2. The request will be handled by the RenderingEngineMiddleware in the RenderingHost
  3. As we have registered the CustomLayoutRequestHandler with the middleware in the Startup.cs, this custom handler will be handling the requests
  4. It checks whether the setting Foundation:Middleware:EndpointConfiguration:UseExperienceEdgeEndpoint is set to true
    1. The CustomLayoutRequestHandler will be using the foundation layer CustomGraphQLEdgeConnector to connect with the Experience Edge endpoint.
    2. The CustomGraphQLEdgeConnector has the below predefined GraphQL query to read the layout response of the given page. It takes site, path and language as the input parameters GraphQL Query
    3. Once the Query is contructed, it uses the GraphQL.Client to make the GraphQL layout request and fetches the layout response
    4. Then the response is sent back to the CustomLayoutRequestHandler where it is deserialized into an object of type SitecoreLayoutResponseContent and the SitecoreLayoutResponse is formed
    5. The RenderingEngineMiddleware uses this LayoutResponse to render the page back
  5. If the setting Foundation:Middleware:EndpointConfiguration:UseExperienceEdgeEndpoint is set to false, then its working by default and uses the JSS Layout Services.

This way we can switch between the Experience Edge End point and JSS Headless Service by this setting 'Foundation:Middleware:EndpointConfiguration:UseExperienceEdgeEndpoint'.

2022-e-square-v's People

Contributors

elakkuvanr avatar anderslaub avatar muso31 avatar akshaysura avatar alexkasaku avatar jammykam avatar michaellwest avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.