I just started practicing with ASP.NET Core, but I have already encountered a problem that I can't find a solution to for 3 hours. I wrote this simple code, but for some reason I can't process the route. The code in app.Map("/delete/{fileName}", (string fileName) =>
simply refuses to work.
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.Map("/delete/{fileName}", (string fileName) =>
{
Console.WriteLine("middleware registered");
});
app.Run(async (context) =>
{
var indexHtmlPage = app.Environment.ContentRootFileProvider.GetFileInfo("/FrontEnd/index.html");
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.SendFileAsync(indexHtmlPage);
});
app.Run();
I tried all the different options I could find, but they don't work. I just want to understand what's going on and solve the problem.