The problem:
I have created an angular freontend app and an asp.net core backend app using the angular template for visual studio.
My goal:
I want to share my backend asp.net core 6 application and my Angular 13 frontend application, so that someone can test the app on another computer, without having to build or install dependencies.
Is there any way to make the asp.net core application serve the index.html file? Would this suffice? How would I achieve this?
So far I have tried this:
app.UseStaticFiles(new StaticFileOptions {
FileProvider = new PhysicalFileProvider(builder.Environment.ContentRootPath),
RequestPath = "/index.html"
});
app.UseRouting();
app.MapFallbackToFile("index.html"); ;
app.MapHub<MainHub>("/main");
I then ran the following command to build the app:
dotnet build -r win-x64 -c Release
I opened the resulting .exe file and opened a browser to the localhost:5000 uri.
However all I get is a 404 Not Found status code.