{"id":409281,"date":"2024-06-29T20:41:47","date_gmt":"2024-06-29T20:41:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=409281"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=409281","title":{"rendered":"<span>\u041a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e JS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 .NET Core (Create React APP + Next JS + .NET Core)<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4c7\/691\/c9e\/4c7691c9eae34359ad0e5cb2b8972c3a.png\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4c7\/691\/c9e\/4c7691c9eae34359ad0e5cb2b8972c3a.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041f\u0430\u0440\u0443 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434 \u0443 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0438\u043b\u0438\u0442\u044c \u043b\u0435\u043d\u0434\u043e\u0441 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043d\u043b\u0430\u0439\u043d \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041d\u0430\u0448 \u0441\u0442\u0435\u043a &#8212; Create React App + .Net Core. \u041f\u043e\u0433\u0443\u0433\u043b\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0438\u043b\u0438\u0442\u044c \u043b\u0435\u043d\u0434\u043e\u0441 \u043d\u0430 Next JS, \u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441 &#8212; \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c. <br \/>\u041c\u044b \u0445\u043e\u0442\u0435\u043b\u0438, \u0447\u0442\u043e \u0431\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <code>yourdomain.com\/app<\/code>, \u0430 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432\u0435\u043b\u0438 \u0431\u044b \u043d\u0430 \u043b\u0435\u043d\u0434\u043e\u0441.<\/p>\n<hr\/>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432 \u043f\u0430\u043f\u043a\u0435, \u0433\u0434\u0435 \u0443 \u0412\u0430\u0441 \u043b\u0435\u0436\u0438\u0442 ClientApp \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 LandingApp \u043a\u0443\u0434\u0430 \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. (\u0415\u0441\u043b\u0438 \u0447\u0442\u043e, \u043f\u0430\u043f\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e)<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9f7\/bce\/8c0\/9f7bce8c010a89ed05165ab3b9bc7554.png\" alt=\"\" title=\"\" width=\"571\" height=\"155\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9f7\/bce\/8c0\/9f7bce8c010a89ed05165ab3b9bc7554.png\"\/><figcaption><\/figcaption><\/figure>\n<hr\/>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0412\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c <strong>startup.cs,<\/strong> \u0447\u0442\u043e\u0431\u044b <strong>.Net Core<\/strong> \u043c\u043e\u0433 &#171;\u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a&#187; \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<p> \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c endpoint routing \u0432 \u043c\u0435\u0442\u043e\u0434\u0435<strong> ConfigureServices<\/strong><\/p>\n<pre><code class=\"cs\">            services.AddMvc(options =>             {                 options.EnableEndpointRouting = false;             });<\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434 <strong>Configure<\/strong> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f <strong>CRA<\/strong><\/p>\n<pre><code class=\"cs\">            app.UseSpaStaticFiles(new StaticFileOptions() {                  RequestPath = \"\/app\"             });<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <strong>\u043c\u0430\u043f\u043f\u0435\u0440<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <code>\/app<\/code> \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"cs\">app.MapWhen(context => context.Request.Path.Value.StartsWith(\"\/app\"), builder =>             {                 builder.UseMvc(routes =>                 {                     routes.MapSpaFallbackRoute(                         \"app\",                         new { controller = \"\", action = \"app\" }                     );                 });                 builder.UseSpa(spa =>                 {                     spa.Options.SourcePath = \"ClientApp\";                                    if (env.IsDevelopment())                     {                         spa.UseReactDevelopmentServer(npmScript: \"start\");                     }                  });             });<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448\u0435 <strong>Next JS<\/strong> \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"cs\">            app.UseSpa(spa =>             {                 spa.Options.SourcePath = \"LandingApp\";                 \/\/ \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0431\u0438\u043b\u0434\u0430, \u043c\u044b \u0437\u0430\u0431\u0438\u043b\u0434\u0438\u043b\u0438 \u043b\u0435\u043d\u0434\u043e\u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e                 \/\/ \u0418 \u0442\u0430\u043c \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043f\u043e \u0442\u0438\u043f\u0443                  \/\/ https:\/\/yourapp.azurewebsites.net                 var url = Configuration.GetSection(\"urls\")[\"landingUrl\"];                 if (env.IsDevelopment())                 {                     url = \"http:\/\/localhost:3005\";                 }                 spa.UseProxyToSpaDevelopmentServer(url);                 if (env.IsDevelopment())                 {                     spa.UseReactDevelopmentServer(npmScript: \"dev\");                 }             });<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0412\u0435\u0441\u044c \u043c\u0435\u0442\u043e\u0434 Configure<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)         {             _env = env;             if (env.IsDevelopment())             {                 app.UseDeveloperExceptionPage();             }             else             {                 app.UseExceptionHandler(\"\/Error\");                 \/\/ The default HSTS value is 30 days. You may want to change this for production scenarios, see https:\/\/aka.ms\/aspnetcore-hsts.                 app.UseHsts();             }              app.Use(async (context, next) =>             {                 context.Response.Headers.Add(\"X-Frame-Options\", \"SAMEORIGIN\");                 await next();             });              app.UseHttpsRedirection();             app.UseStaticFiles();             app.UseSpaStaticFiles(new StaticFileOptions() {                  RequestPath = \"\/app\"             });              app.UseRouting();             app.UseAuthentication();             app.UseAuthorization();             app.UseEndpoints(endpoints =>             {                 endpoints.MapControllerRoute(                     name: \"default\",                     pattern: \"{controller}\/{action=Index}\/{id?}\");             });              app.MapWhen(context => context.Request.Path.Value.StartsWith(\"\/app\"), builder =>             {                 builder.UseMvc(routes =>                 {                     routes.MapSpaFallbackRoute(                         \"app\",                         new { controller = \"\", action = \"app\" }                     );                 });                 builder.UseSpa(spa =>                 {                     spa.Options.SourcePath = \"ClientApp\";                                    if (env.IsDevelopment())                     {                         spa.UseReactDevelopmentServer(npmScript: \"start\");                     }                  });             });              app.UseSpa(spa =>             {                 spa.Options.SourcePath = \"LandingApp\";                 var url = Configuration.GetSection(\"urls\")[\"landingUrl\"];                 if (env.IsDevelopment())                 {                     url = \"http:\/\/localhost:3005\";                 }                 spa.UseProxyToSpaDevelopmentServer(url);                 if (env.IsDevelopment())                 {                     spa.UseReactDevelopmentServer(npmScript: \"dev\");                 }             });          }<\/code><\/pre>\n<\/div>\n<\/details>\n<hr\/>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c CRA \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0440\u0430\u0442\u044c \u0431\u0430\u043d\u0434\u043b \u0442.\u043a. \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435, \u0430 \u0432 <code>\/app<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u0432 <strong>package.json<\/strong> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>homepage: \"\/app\/\"<\/code><\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/de8\/501\/64d\/de850164dd05099028a83664ba38dfe7.png\" width=\"171\" height=\"80\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/de8\/501\/64d\/de850164dd05099028a83664ba38dfe7.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>history<\/strong> \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0449\u0435 <code>basename: '\/app'<\/code><\/p>\n<pre><code class=\"javascript\">import { connectRouter } from 'connected-react-router'; import { createBrowserHistory } from 'history';  export const history = createBrowserHistory({   basename: '\/app', });  export const routerReducer = connectRouter(history);<\/code><\/pre>\n<p>\u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0440\u043e\u0434\u0435 \u0432\u0441\u0435 \ud83d\ude42<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/583830\/\"> https:\/\/habr.com\/ru\/articles\/583830\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041f\u0430\u0440\u0443 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434 \u0443 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0438\u043b\u0438\u0442\u044c \u043b\u0435\u043d\u0434\u043e\u0441 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043d\u043b\u0430\u0439\u043d \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041d\u0430\u0448 \u0441\u0442\u0435\u043a &#8212; Create React App + .Net Core. \u041f\u043e\u0433\u0443\u0433\u043b\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0438\u043b\u0438\u0442\u044c \u043b\u0435\u043d\u0434\u043e\u0441 \u043d\u0430 Next JS, \u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441 &#8212; \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c. <br \/>\u041c\u044b \u0445\u043e\u0442\u0435\u043b\u0438, \u0447\u0442\u043e \u0431\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <code>yourdomain.com\/app<\/code>, \u0430 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432\u0435\u043b\u0438 \u0431\u044b \u043d\u0430 \u043b\u0435\u043d\u0434\u043e\u0441.<\/p>\n<hr\/>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432 \u043f\u0430\u043f\u043a\u0435, \u0433\u0434\u0435 \u0443 \u0412\u0430\u0441 \u043b\u0435\u0436\u0438\u0442 ClientApp \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 LandingApp \u043a\u0443\u0434\u0430 \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. (\u0415\u0441\u043b\u0438 \u0447\u0442\u043e, \u043f\u0430\u043f\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e)<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<hr\/>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0412\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c <strong>startup.cs,<\/strong> \u0447\u0442\u043e\u0431\u044b <strong>.Net Core<\/strong> \u043c\u043e\u0433 &#171;\u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a&#187; \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<p> \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c endpoint routing \u0432 \u043c\u0435\u0442\u043e\u0434\u0435<strong> ConfigureServices<\/strong><\/p>\n<pre><code class=\"cs\">            services.AddMvc(options =>             {                 options.EnableEndpointRouting = false;             });<\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434 <strong>Configure<\/strong> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f <strong>CRA<\/strong><\/p>\n<pre><code class=\"cs\">            app.UseSpaStaticFiles(new StaticFileOptions() {                  RequestPath = \"\/app\"             });<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <strong>\u043c\u0430\u043f\u043f\u0435\u0440<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <code>\/app<\/code> \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"cs\">app.MapWhen(context => context.Request.Path.Value.StartsWith(\"\/app\"), builder =>             {                 builder.UseMvc(routes =>                 {                     routes.MapSpaFallbackRoute(                         \"app\",                         new { controller = \"\", action = \"app\" }                     );                 });                 builder.UseSpa(spa =>                 {                     spa.Options.SourcePath = \"ClientApp\";                                    if (env.IsDevelopment())                     {                         spa.UseReactDevelopmentServer(npmScript: \"start\");                     }                  });             });<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448\u0435 <strong>Next JS<\/strong> \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"cs\">            app.UseSpa(spa =>             {                 spa.Options.SourcePath = \"LandingApp\";                 \/\/ \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0431\u0438\u043b\u0434\u0430, \u043c\u044b \u0437\u0430\u0431\u0438\u043b\u0434\u0438\u043b\u0438 \u043b\u0435\u043d\u0434\u043e\u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e                 \/\/ \u0418 \u0442\u0430\u043c \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043f\u043e \u0442\u0438\u043f\u0443                  \/\/ https:\/\/yourapp.azurewebsites.net                 var url = Configuration.GetSection(\"urls\")[\"landingUrl\"];                 if (env.IsDevelopment())                 {                     url = \"http:\/\/localhost:3005\";                 }                 spa.UseProxyToSpaDevelopmentServer(url);                 if (env.IsDevelopment())                 {                     spa.UseReactDevelopmentServer(npmScript: \"dev\");                 }             });<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0412\u0435\u0441\u044c \u043c\u0435\u0442\u043e\u0434 Configure<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)         {             _env = env;             if (env.IsDevelopment())             {                 app.UseDeveloperExceptionPage();             }             else             {                 app.UseExceptionHandler(\"\/Error\");                 \/\/ The default HSTS value is 30 days. You may want to change this for production scenarios, see https:\/\/aka.ms\/aspnetcore-hsts.                 app.UseHsts();             }              app.Use(async (context, next) =>             {                 context.Response.Headers.Add(\"X-Frame-Options\", \"SAMEORIGIN\");                 await next();             });              app.UseHttpsRedirection();             app.UseStaticFiles();             app.UseSpaStaticFiles(new StaticFileOptions() {                  RequestPath = \"\/app\"             });              app.UseRouting();             app.UseAuthentication();             app.UseAuthorization();             app.UseEndpoints(endpoints =>             {                 endpoints.MapControllerRoute(                     name: \"default\",                     pattern: \"{controller}\/{action=Index}\/{id?}\");             });              app.MapWhen(context => context.Request.Path.Value.StartsWith(\"\/app\"), builder =>             {                 builder.UseMvc(routes =>                 {                     routes.MapSpaFallbackRoute(                         \"app\",                         new { controller = \"\", action = \"app\" }                     );                 });                 builder.UseSpa(spa =>                 {                     spa.Options.SourcePath = \"ClientApp\";                                    if (env.IsDevelopment())                     {                         spa.UseReactDevelopmentServer(npmScript: \"start\");                     }                  });             });              app.UseSpa(spa =>             {                 spa.Options.SourcePath = \"LandingApp\";                 var url = Configuration.GetSection(\"urls\")[\"landingUrl\"];                 if (env.IsDevelopment())                 {                     url = \"http:\/\/localhost:3005\";                 }                 spa.UseProxyToSpaDevelopmentServer(url);                 if (env.IsDevelopment())                 {                     spa.UseReactDevelopmentServer(npmScript: \"dev\");                 }             });          }<\/code><\/pre>\n<\/div>\n<\/details>\n<hr\/>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c CRA \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0440\u0430\u0442\u044c \u0431\u0430\u043d\u0434\u043b \u0442.\u043a. \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435, \u0430 \u0432 <code>\/app<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u0432 <strong>package.json<\/strong> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>homepage: \"\/app\/\"<\/code><\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>history<\/strong> \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0449\u0435 <code>basename: '\/app'<\/code><\/p>\n<pre><code class=\"javascript\">import { connectRouter } from 'connected-react-router'; import { createBrowserHistory } from 'history';  export const history = createBrowserHistory({   basename: '\/app', });  export const routerReducer = connectRouter(history);<\/code><\/pre>\n<p>\u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0440\u043e\u0434\u0435 \u0432\u0441\u0435 \ud83d\ude42<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/583830\/\"> https:\/\/habr.com\/ru\/articles\/583830\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-409281","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/409281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=409281"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/409281\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=409281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=409281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=409281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}