lowercase routes (#21)
This commit is contained in:
parent
06469b52d4
commit
2325522b98
@ -21,7 +21,7 @@ namespace Website.Controllers
|
|||||||
return View(await _bus.Send(new ListLinksQuery()));
|
return View(await _bus.Send(new ListLinksQuery()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{controller}/{id}")]
|
[HttpGet("{controller}/{id:guid}")]
|
||||||
public async Task<IActionResult> Show(Guid id)
|
public async Task<IActionResult> Show(Guid id)
|
||||||
{
|
{
|
||||||
return View(await _bus.Send(new GetLinkQuery(id)));
|
return View(await _bus.Send(new GetLinkQuery(id)));
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using HN.Infrastructure;
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@ -27,6 +28,13 @@ namespace Website
|
|||||||
services.AddScoped<IDbContext, HNDbContext>();
|
services.AddScoped<IDbContext, HNDbContext>();
|
||||||
services.AddScoped<ILinkRepository, LinkRepository>();
|
services.AddScoped<ILinkRepository, LinkRepository>();
|
||||||
services.AddMediatR(typeof(HN.Application.AddLinkCommand));
|
services.AddMediatR(typeof(HN.Application.AddLinkCommand));
|
||||||
|
|
||||||
|
services.Configure<RouteOptions>(options =>
|
||||||
|
{
|
||||||
|
options.LowercaseUrls = true;
|
||||||
|
options.LowercaseQueryStrings = true;
|
||||||
|
});
|
||||||
|
|
||||||
services.AddControllersWithViews();
|
services.AddControllersWithViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,10 @@ Mise en place de la couche applicative avec `MediatR` et implémentation du prem
|
|||||||
|
|
||||||
## Le site internet en MVC
|
## Le site internet en MVC
|
||||||
|
|
||||||
|
### Options pattern
|
||||||
|
|
||||||
|
Permet d'avoir des objets de configuration facilement sortable depuis l'appsettings. Utilisation de https://docs.microsoft.com/fr-fr/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0.
|
||||||
|
|
||||||
### Ajout des messages "flashs"
|
### Ajout des messages "flashs"
|
||||||
|
|
||||||
Permet de notifier l'utilisateur d'une action. Utilisation des `TempData` (données supprimées à la prochaine requête ou après la lecture).
|
Permet de notifier l'utilisateur d'une action. Utilisation des `TempData` (données supprimées à la prochaine requête ou après la lecture).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user