I created a fresh .NET Core with React.js project, which has this by default in Program.cs
:
app.MapControllerRoute(
name: "default",
pattern: "{controller}/{action=Index}/{id?}");
app.MapFallbackToFile("index.html"); ;
The provided WeatherForecastController
works, i.e. this works:
https://localhost:44449/weatherforecast
But if I copy WeatherForecastController.cs
and name it MyNewController.cs
like this, it won't work.
[ApiController]
[Route("[controller]")]
public class MyNewController : ControllerBase
{
...
https://localhost:44449/mynew
returns the content of index.html.
What am I missing?