I have developed .NET5 web api and React app in two different projects. Now it's time to deploy API and React app to IIS, but on trying to achieve that I realized that they have to be added as same app in IIS. I wish that routing setup would be:
- / => React App
- /api/v1/controller/method => API endpoints
Both of my apps individually has this setup, I just cannot merge them :/
I cannot find examples where dotnet template isn't used. So far I have tried to accomplish that through this code (I have skipped non related configurations code):
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp";
});
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseSpaStaticFiles();