Start a JSS app in connected mode
Develop locally against a running Sitecore instance
To develop a JSS application locally against a running Sitecore instance, you must start your JSS application in connected mode.
When running your JSS application in connected mode, the rendering of the application is performed by the browser.
The Sitecore databases hold the content, layout data, and component registrations, so you do not need to define mock data locally in the application. The application retrieves data from Sitecore through HTTP requests.
The following diagram shows how the HTTP requests to acquire Sitecore data.
All JSS applications created with a framework-specific SDK using the JSS CLI command
jss create include a script in their
package.json file to start the application in connected mode.
To start the application in connected mode:
Follow the steps to connect and deploy your application to Sitecore.
In a terminal, run the following script:RequestResponseshell
The script starts the local development server.Note
If you migrated from the code-first to the Sitecore-first development workflow and renamed the script
jss start:connected, you must run the newly named script instead.
In your browser, open
http://localhost:3000if it does not open automatically.
If you are signed in to Sitecore in Experience Editor mode, running the JSS app in connected mode might result in extra code-like markup being delivered to your JSS application. If this happens, switch your site to Preview or Normal mode in Sitecore and the extra markup disappears.