I have an Angular project which I want to host. There is a template in asp.net core web project for Angular. I studied the template and created an empty template project for ASP.NET core and installed required packages (like SPA and all other packages) Now I want to host the Angular project (which is not in the directory of.net project) through .net project.
The catch here is that I do not have the source code of this Angular project. We only get the binary package from Nexus. I observed that in the startup.cs file we get to provide the source path of project. Something like this
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseAngularCliServer(npmScript: "start");
}
From this folder it opens the package.json file and finds for start command and does mg serve. Also it asks for its root path.
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/dist";
});
}
I am unaware of this part. My understanding is that the dist folder must be getting created through configuration before using it here.I am also unaware of how to configure it correctly if the source path id different from ClientApp. Can we use any such setting and make this work? The ultimate goal is to host the Angular project using HTTP.SYS from asp.net core project. Is this possible? What is the best way to do this?