Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

dotnet core vue in subdirectory

public void ConfigureServices(IServiceCollection services) {
    ...
    services.AddSpaStaticFiles(configuration => { configuration.RootPath = "wwwroot"; });
    ...
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
    ...
    app.Map(
        "/<<SUBFOLDER>>",
        builder =>
        {
            builder.UseSpa(spa =>
            {
                if (env.IsDevelopment())
                {
                    spa.Options.SourcePath = "<<PATH-TO-ANGULAR>>";
                    spa.UseAngularCliServer(npmScript: "start-dotnet");
                }
                else
                {
                    spa.Options.SourcePath = "wwwroot/<<SUBFOLDER>>";
                    spa.Options.DefaultPageStaticFileOptions = new StaticFileOptions
                    {
                        FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/<<SUBFOLDER>>"))
                    };
                }
            });
        }
    );
    ...
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: Set database timeout in Entity Framework 
Csharp :: JAJAAJAJAJ 
Csharp :: itext7 c# memorystream 
Csharp :: how to add the ssl certificate in vb.net application 
Csharp :: telerik mvc grid required field 
Csharp :: input string was not in a correct format convert to double 
Csharp :: hacker 
Csharp :: .net return context.Result without extra new objectResult 
Csharp :: new guid c# always returns 0 
Csharp :: membership get user id 
Csharp :: join 2 list rows into one row and add totals fields C# 
Csharp :: unity tostring keep decimal part 
Csharp :: dotnet target specific framework 
Csharp :: cqrs design pattern .net core 
Csharp :: how to make a draggable visual studio panel 
Csharp :: c# use list as a paramter 
Csharp :: CRUD configuration MVC with Firebase 
Csharp :: Unable to Write json variable c# getting an error 
Csharp :: pyqt single instance 
Csharp :: unity button text changes when clicked 
Csharp :: net use error 67 
Csharp :: how to authorize token when consuming api in c# 
Csharp :: c# lernen kostenlos 
Csharp :: c# operators 
Csharp :: index in foreach in c# 
Csharp :: c# blazor in .net framework 
Csharp :: unity find disabled gameobject 
Csharp :: multithreading in .net core 
Csharp :: how do i repeat a button on visual studio code 
Csharp :: polling data source c# using threads 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =