How would you best configure JSS to work with multiple Sitecore ?
One of the key benefits I can see from moving to JSS is the way developers can work with the different tools. In particular the lure of Hot Module Replacement (HMR) adds such a lot of positives for development speed. Therefore its key we don't lose this capability - building the whole JSS project for every change would not be a good solution.
We have a traditional Sitecore setup which relies heavily on <sites>
. Examples being configured as follows:
- www.domain.com <= en-ca
- www.domain.com/fr <= fr-ca
- www.anotherdomain.com <= en-au
- www.anotherdomain.com/fr and www.anotherdomain.com/fr-fr shouldn't work
In the non-jss world we are achieving the /fr
url chunk via config in <sites>
for the french site of: virtualFolder="/fr" physicalFolder="/fr"
When running in headless mode I believe this could be achieved with the configuration of express however how could this be done when doing connected, 'HMR driven development' (jss start:connected
) as this by default always runs localhost:3000
jss
add a comment |
One of the key benefits I can see from moving to JSS is the way developers can work with the different tools. In particular the lure of Hot Module Replacement (HMR) adds such a lot of positives for development speed. Therefore its key we don't lose this capability - building the whole JSS project for every change would not be a good solution.
We have a traditional Sitecore setup which relies heavily on <sites>
. Examples being configured as follows:
- www.domain.com <= en-ca
- www.domain.com/fr <= fr-ca
- www.anotherdomain.com <= en-au
- www.anotherdomain.com/fr and www.anotherdomain.com/fr-fr shouldn't work
In the non-jss world we are achieving the /fr
url chunk via config in <sites>
for the french site of: virtualFolder="/fr" physicalFolder="/fr"
When running in headless mode I believe this could be achieved with the configuration of express however how could this be done when doing connected, 'HMR driven development' (jss start:connected
) as this by default always runs localhost:3000
jss
add a comment |
One of the key benefits I can see from moving to JSS is the way developers can work with the different tools. In particular the lure of Hot Module Replacement (HMR) adds such a lot of positives for development speed. Therefore its key we don't lose this capability - building the whole JSS project for every change would not be a good solution.
We have a traditional Sitecore setup which relies heavily on <sites>
. Examples being configured as follows:
- www.domain.com <= en-ca
- www.domain.com/fr <= fr-ca
- www.anotherdomain.com <= en-au
- www.anotherdomain.com/fr and www.anotherdomain.com/fr-fr shouldn't work
In the non-jss world we are achieving the /fr
url chunk via config in <sites>
for the french site of: virtualFolder="/fr" physicalFolder="/fr"
When running in headless mode I believe this could be achieved with the configuration of express however how could this be done when doing connected, 'HMR driven development' (jss start:connected
) as this by default always runs localhost:3000
jss
One of the key benefits I can see from moving to JSS is the way developers can work with the different tools. In particular the lure of Hot Module Replacement (HMR) adds such a lot of positives for development speed. Therefore its key we don't lose this capability - building the whole JSS project for every change would not be a good solution.
We have a traditional Sitecore setup which relies heavily on <sites>
. Examples being configured as follows:
- www.domain.com <= en-ca
- www.domain.com/fr <= fr-ca
- www.anotherdomain.com <= en-au
- www.anotherdomain.com/fr and www.anotherdomain.com/fr-fr shouldn't work
In the non-jss world we are achieving the /fr
url chunk via config in <sites>
for the french site of: virtualFolder="/fr" physicalFolder="/fr"
When running in headless mode I believe this could be achieved with the configuration of express however how could this be done when doing connected, 'HMR driven development' (jss start:connected
) as this by default always runs localhost:3000
jss
jss
edited Jan 30 at 11:48
boro2g
asked Jan 30 at 11:32
boro2gboro2g
375111
375111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
When running in connected mode, there is an Express server that runs next to your JSS app (by default at localhost:3000
). However, your app is making requests to your Sitecore instance via whatever URL you've defined in the layoutServiceHost
property in scjssconfig.json
.
That means you can modify the layoutServiceHost
property to use whatever site hostName is appropriate for the <site />
nodes you have defined in your Sitecore instance.
If you need to modify the layoutServiceHost
value at runtime, for instance to reflect some URL fragment or parameter, then you can do so wherever you make a call to dataApi.fetchRouteData
(or "globally" in your app wherever you resolve routes). The JSS sample apps make that call in the RouteHandler
component (in React and Vue), and you'll see in the getRouteData
method of that component that it sets the layoutServiceConfig.host
property to the config.sitecoreApiHost
value. That value, by default, comes from scjssconfig.json
, but as mentioned it can come from anywhere or be modified prior to usage.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "664"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f16327%2fhow-would-you-best-configure-jss-to-work-with-multiple-sitecore-sites%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
When running in connected mode, there is an Express server that runs next to your JSS app (by default at localhost:3000
). However, your app is making requests to your Sitecore instance via whatever URL you've defined in the layoutServiceHost
property in scjssconfig.json
.
That means you can modify the layoutServiceHost
property to use whatever site hostName is appropriate for the <site />
nodes you have defined in your Sitecore instance.
If you need to modify the layoutServiceHost
value at runtime, for instance to reflect some URL fragment or parameter, then you can do so wherever you make a call to dataApi.fetchRouteData
(or "globally" in your app wherever you resolve routes). The JSS sample apps make that call in the RouteHandler
component (in React and Vue), and you'll see in the getRouteData
method of that component that it sets the layoutServiceConfig.host
property to the config.sitecoreApiHost
value. That value, by default, comes from scjssconfig.json
, but as mentioned it can come from anywhere or be modified prior to usage.
add a comment |
When running in connected mode, there is an Express server that runs next to your JSS app (by default at localhost:3000
). However, your app is making requests to your Sitecore instance via whatever URL you've defined in the layoutServiceHost
property in scjssconfig.json
.
That means you can modify the layoutServiceHost
property to use whatever site hostName is appropriate for the <site />
nodes you have defined in your Sitecore instance.
If you need to modify the layoutServiceHost
value at runtime, for instance to reflect some URL fragment or parameter, then you can do so wherever you make a call to dataApi.fetchRouteData
(or "globally" in your app wherever you resolve routes). The JSS sample apps make that call in the RouteHandler
component (in React and Vue), and you'll see in the getRouteData
method of that component that it sets the layoutServiceConfig.host
property to the config.sitecoreApiHost
value. That value, by default, comes from scjssconfig.json
, but as mentioned it can come from anywhere or be modified prior to usage.
add a comment |
When running in connected mode, there is an Express server that runs next to your JSS app (by default at localhost:3000
). However, your app is making requests to your Sitecore instance via whatever URL you've defined in the layoutServiceHost
property in scjssconfig.json
.
That means you can modify the layoutServiceHost
property to use whatever site hostName is appropriate for the <site />
nodes you have defined in your Sitecore instance.
If you need to modify the layoutServiceHost
value at runtime, for instance to reflect some URL fragment or parameter, then you can do so wherever you make a call to dataApi.fetchRouteData
(or "globally" in your app wherever you resolve routes). The JSS sample apps make that call in the RouteHandler
component (in React and Vue), and you'll see in the getRouteData
method of that component that it sets the layoutServiceConfig.host
property to the config.sitecoreApiHost
value. That value, by default, comes from scjssconfig.json
, but as mentioned it can come from anywhere or be modified prior to usage.
When running in connected mode, there is an Express server that runs next to your JSS app (by default at localhost:3000
). However, your app is making requests to your Sitecore instance via whatever URL you've defined in the layoutServiceHost
property in scjssconfig.json
.
That means you can modify the layoutServiceHost
property to use whatever site hostName is appropriate for the <site />
nodes you have defined in your Sitecore instance.
If you need to modify the layoutServiceHost
value at runtime, for instance to reflect some URL fragment or parameter, then you can do so wherever you make a call to dataApi.fetchRouteData
(or "globally" in your app wherever you resolve routes). The JSS sample apps make that call in the RouteHandler
component (in React and Vue), and you'll see in the getRouteData
method of that component that it sets the layoutServiceConfig.host
property to the config.sitecoreApiHost
value. That value, by default, comes from scjssconfig.json
, but as mentioned it can come from anywhere or be modified prior to usage.
answered Jan 30 at 12:55
Adam WeberAdam Weber
1,535314
1,535314
add a comment |
add a comment |
Thanks for contributing an answer to Sitecore Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f16327%2fhow-would-you-best-configure-jss-to-work-with-multiple-sitecore-sites%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown