-
Notifications
You must be signed in to change notification settings - Fork 467
Enable Server Side Rendering
Asad Sahi edited this page Jan 25, 2018
·
1 revision
To enable SSR, you need to make a few changes.
- Uncomment these lines in Startup.cs
// spa.UseSpaPrerendering(options =>
// {
// options.BootModulePath = $"{spa.Options.SourcePath}/dist-server/main.bundle.js";
// options.BootModuleBuilder = env.IsDevelopment() ? new AngularCliBuilder(npmScript: "build:ssr") : null;
// options.ExcludeUrls = new[] { "/sockjs-node" };
// options.SupplyData = (requestContext, obj) =>
// {
// // var result = appService.GetApplicationData(requestContext).GetAwaiter().GetResult();
// obj.Add("Cookies", requestContext.Request.Cookies);
// };
// });
- Set
BuildServerSideRenderer
inAspNetCoreSpa.csproj
file totrue
<BuildServerSideRenderer>true</BuildServerSideRenderer>