mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
add Seed route
This commit is contained in:
parent
eece976d81
commit
6d328fb154
2 changed files with 12 additions and 2 deletions
|
|
@ -41,7 +41,7 @@ public void Configure(IApplicationBuilder app)
|
|||
app.UseStaticFiles();
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute("default", "v{version:apiVersion}/{controller=Default}/{action=Get}/{id?}");
|
||||
routes.MapRoute("default", "v{version:apiVersion}/{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
MigrateAndSeedDatabase(app);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public ListsController(IMemoryCache memoryCache, FilterListService filterListSer
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Get()
|
||||
public IActionResult Index()
|
||||
{
|
||||
return memoryCache.GetOrCreate(CacheKeys.Entry, entry =>
|
||||
{
|
||||
|
|
@ -28,5 +28,15 @@ public IActionResult Get()
|
|||
return Json(filterListService.GetAllSummaries());
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Seed()
|
||||
{
|
||||
return memoryCache.GetOrCreate(CacheKeys.Entry, entry =>
|
||||
{
|
||||
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(86400);
|
||||
return Json(filterListService.GetAllSeeds());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue