Joost Broekhuizen

Hands on Solution Architect and Sitecore MVP, mainly interested in .NET technology, Sitecore and WebServices. Interested in building and managing interfaces, as well as managing projects from an architectural point of view in those areas.

Sitecore JSS -  Sitecore first

By Joost Broekhuizen

Recently I started a project where we are upgrading an existing Sitecore 9 MVC portal with AngularJS to Sitecore JSS with Angular 7. With this portal being already implemented, and content preexisting in the solution we wanted to start this with a Sitecore first approach.
In this approach we create the JSS layout service endpoint that return Json containing the same content a component now renders in the MVC controller rendering, reusing existing content, templates etc.

First thing first

To start, obviously as a Sitecore developer you have to install the Sitecore JSS server components into your environment. After that you create a Sitedefinition like entry for your JavaScriptServices where you register your JSS app and set the start item for your app root. You setup your API key as defined in the JSS doc site.
To make sure your Sitecore instance is aware of this app and where in the Sitecore tree it 'lives'. You extend your Sitecore SiteDefinitions config with the app registration:

Joost-blog-1
In our case the app we work on falls in the same existing site definition as our current implementation, so the sitecorePath falls in a subpath of our site. If your's doesn't then make sure you define a site that has your approot in scope, and assign an appropriate hostname etc.

Read the rest of the personal blog here