using Microsoft.AspNetCore.Mvc; namespace API.Core.Controllers; /// /// Handles requests that do not match any other route, used as the application's fallback controller. /// /// /// Excluded from API explorer/Swagger output via [ApiExplorerSettings(IgnoreApi = true)]. /// Wired up as the fallback target via app.MapFallbackToController("Handle404", "NotFound") in /// Program.cs. /// [ApiController] [ApiExplorerSettings(IgnoreApi = true)] [Route("error")] // required public class NotFoundController : ControllerBase { /// /// Returns a generic 404 response for any request that did not match a defined route. /// /// A 404 Not Found result with a JSON body containing a "Route not found." message. [HttpGet("404")] //required public IActionResult Handle404() { return NotFound(new { message = "Route not found." }); } }