episerver / Foundation-spa-react

Apache License 2.0
35 stars 16 forks source link

How is the website hosted technically? #26

Open OZZlE opened 2 years ago

OZZlE commented 2 years ago

Does this use Nodejs for serverside rendering? Do you use IISNode?

Or is the FE rendering clientside (JavaScript) only?

Or do you render the content in C#/.Net and run React on top of it? How do you avoid all elements rerendering if so? How do you avoid writing the html twice if so?

The readme doesn't seem to describe how you build and start a server in production and what the prod requirements are (compared to dev reqs)


Sidemark: React doesn't recommend inheritance https://reactjs.org/docs/composition-vs-inheritance.html#so-what-about-inheritance also the latest React syntax, React hooks doesn't really support it https://reactjs.org/docs/hooks-intro.html

jessycormier commented 2 months ago

FE is Next.JS (react) and is rendered both in browser and back-end using a middleware is rendering SSR (Server Side Rendering) of the site.

Inside of src/Headless.Cms/Startup.cs you'll find this section

#region Headless.CMS Extensions & Services
            services
                .AddJsonConversionStandard()        // Ensure that all JSON responses align with the ContentDeliveryAPI
                .AddFoundationSettings()            // Add settings extension
                .ApplyContentApiExtensions()        // Add extensions for the ContentDeliveryAPI to fully support OPE
                .AddContentActionApi()              // Add Content Actions API
                .AddApiExplorer(options => {        // Add & Configure API Explorer
                    options.DefaultAuthScopes.Add(ContentDefinitionsApiOptionsDefaults.Scope);
                    options.DefaultAuthScopes.Add(ContentManagementApiOptionsDefaults.Scope);
                    options.DefaultAuthScopes.Add(ContentDeliveryApiOptionsDefaults.Scope);
                })
                .AddNodeJs(_configuration)          // Add Frontend proxy
                .AddHeadlessCmsInitialContent();    // Add Initial content
            #endregion

and later on

            #region Headless.CMS Extensions & Services
            app.UseBaaijteOptimizelyImageSharp();
            app.UseFoundationSettings();
            app.UseContentActionApi();
            app.UseApiExplorer();
            app.UseNodeJs();
            #endregion

The section app.UserNodeJs();. You'll find a folder under the headless.cms project called Infrastructure/NodeJsMiddleware which has some code related to node building the SSR content.

Seeing as this issue is 2 years old, perhaps it can be closed or is no longer relevant?