mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Cache routes
This commit is contained in:
parent
89761ac141
commit
c3dd1c4187
2
app.php
2
app.php
@ -102,5 +102,7 @@ $errorMiddleware->setDefaultErrorHandler(
|
|||||||
|
|
||||||
$app->add(new CorsMiddleware($app->getResponseFactory()));
|
$app->add(new CorsMiddleware($app->getResponseFactory()));
|
||||||
|
|
||||||
|
$app->getRouteCollector()->setCacheFile(GROCY_DATAPATH . '/viewcache/route_cache.php');
|
||||||
|
|
||||||
ob_clean(); // No response output before here
|
ob_clean(); // No response output before here
|
||||||
$app->run();
|
$app->run();
|
||||||
|
32
routes.php
32
routes.php
@ -43,8 +43,6 @@ $app->group('', function (RouteCollectorProxy $group) {
|
|||||||
$group->get('/product/{productId}/grocycode', '\Grocy\Controllers\StockController:ProductGrocycodeImage');
|
$group->get('/product/{productId}/grocycode', '\Grocy\Controllers\StockController:ProductGrocycodeImage');
|
||||||
|
|
||||||
// Stock handling routes
|
// Stock handling routes
|
||||||
if (GROCY_FEATURE_FLAG_STOCK)
|
|
||||||
{
|
|
||||||
$group->get('/stockoverview', '\Grocy\Controllers\StockController:Overview');
|
$group->get('/stockoverview', '\Grocy\Controllers\StockController:Overview');
|
||||||
$group->get('/stockentries', '\Grocy\Controllers\StockController:Stockentries');
|
$group->get('/stockentries', '\Grocy\Controllers\StockController:Stockentries');
|
||||||
$group->get('/purchase', '\Grocy\Controllers\StockController:Purchase');
|
$group->get('/purchase', '\Grocy\Controllers\StockController:Purchase');
|
||||||
@ -63,46 +61,31 @@ $app->group('', function (RouteCollectorProxy $group) {
|
|||||||
$group->get('/stockentry/{entryId}/grocycode', '\Grocy\Controllers\StockController:StockEntryGrocycodeImage');
|
$group->get('/stockentry/{entryId}/grocycode', '\Grocy\Controllers\StockController:StockEntryGrocycodeImage');
|
||||||
$group->get('/stockentry/{entryId}/label', '\Grocy\Controllers\StockController:StockEntryGrocycodeLabel');
|
$group->get('/stockentry/{entryId}/label', '\Grocy\Controllers\StockController:StockEntryGrocycodeLabel');
|
||||||
$group->get('/quantityunitconversionsresolved', '\Grocy\Controllers\StockController:QuantityUnitConversionsResolved');
|
$group->get('/quantityunitconversionsresolved', '\Grocy\Controllers\StockController:QuantityUnitConversionsResolved');
|
||||||
|
|
||||||
$group->get('/stockreports/spendings', '\Grocy\Controllers\StockReportsController:Spendings');
|
$group->get('/stockreports/spendings', '\Grocy\Controllers\StockReportsController:Spendings');
|
||||||
}
|
|
||||||
|
|
||||||
// Stock price tracking
|
// Stock price tracking
|
||||||
if (GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
|
||||||
{
|
|
||||||
$group->get('/shoppinglocations', '\Grocy\Controllers\StockController:ShoppingLocationsList');
|
$group->get('/shoppinglocations', '\Grocy\Controllers\StockController:ShoppingLocationsList');
|
||||||
$group->get('/shoppinglocation/{shoppingLocationId}', '\Grocy\Controllers\StockController:ShoppingLocationEditForm');
|
$group->get('/shoppinglocation/{shoppingLocationId}', '\Grocy\Controllers\StockController:ShoppingLocationEditForm');
|
||||||
}
|
|
||||||
|
|
||||||
// Shopping list routes
|
// Shopping list routes
|
||||||
if (GROCY_FEATURE_FLAG_SHOPPINGLIST)
|
|
||||||
{
|
|
||||||
$group->get('/shoppinglist', '\Grocy\Controllers\StockController:ShoppingList');
|
$group->get('/shoppinglist', '\Grocy\Controllers\StockController:ShoppingList');
|
||||||
$group->get('/shoppinglistitem/{itemId}', '\Grocy\Controllers\StockController:ShoppingListItemEditForm');
|
$group->get('/shoppinglistitem/{itemId}', '\Grocy\Controllers\StockController:ShoppingListItemEditForm');
|
||||||
$group->get('/shoppinglist/{listId}', '\Grocy\Controllers\StockController:ShoppingListEditForm');
|
$group->get('/shoppinglist/{listId}', '\Grocy\Controllers\StockController:ShoppingListEditForm');
|
||||||
$group->get('/shoppinglistsettings', '\Grocy\Controllers\StockController:ShoppingListSettings');
|
$group->get('/shoppinglistsettings', '\Grocy\Controllers\StockController:ShoppingListSettings');
|
||||||
}
|
|
||||||
|
|
||||||
// Recipe routes
|
// Recipe routes
|
||||||
if (GROCY_FEATURE_FLAG_RECIPES)
|
|
||||||
{
|
|
||||||
$group->get('/recipes', '\Grocy\Controllers\RecipesController:Overview');
|
$group->get('/recipes', '\Grocy\Controllers\RecipesController:Overview');
|
||||||
$group->get('/recipe/{recipeId}', '\Grocy\Controllers\RecipesController:RecipeEditForm');
|
$group->get('/recipe/{recipeId}', '\Grocy\Controllers\RecipesController:RecipeEditForm');
|
||||||
$group->get('/recipe/{recipeId}/pos/{recipePosId}', '\Grocy\Controllers\RecipesController:RecipePosEditForm');
|
$group->get('/recipe/{recipeId}/pos/{recipePosId}', '\Grocy\Controllers\RecipesController:RecipePosEditForm');
|
||||||
$group->get('/recipessettings', '\Grocy\Controllers\RecipesController:RecipesSettings');
|
$group->get('/recipessettings', '\Grocy\Controllers\RecipesController:RecipesSettings');
|
||||||
$group->get('/recipe/{recipeId}/grocycode', '\Grocy\Controllers\RecipesController:RecipeGrocycodeImage');
|
$group->get('/recipe/{recipeId}/grocycode', '\Grocy\Controllers\RecipesController:RecipeGrocycodeImage');
|
||||||
|
|
||||||
if (GROCY_FEATURE_FLAG_RECIPES_MEALPLAN)
|
// Meal plan routes
|
||||||
{
|
|
||||||
$group->get('/mealplan', '\Grocy\Controllers\RecipesController:MealPlan');
|
$group->get('/mealplan', '\Grocy\Controllers\RecipesController:MealPlan');
|
||||||
$group->get('/mealplansections', '\Grocy\Controllers\RecipesController:MealPlanSectionsList');
|
$group->get('/mealplansections', '\Grocy\Controllers\RecipesController:MealPlanSectionsList');
|
||||||
$group->get('/mealplansection/{sectionId}', '\Grocy\Controllers\RecipesController:MealPlanSectionEditForm');
|
$group->get('/mealplansection/{sectionId}', '\Grocy\Controllers\RecipesController:MealPlanSectionEditForm');
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Chore routes
|
// Chore routes
|
||||||
if (GROCY_FEATURE_FLAG_CHORES)
|
|
||||||
{
|
|
||||||
$group->get('/choresoverview', '\Grocy\Controllers\ChoresController:Overview');
|
$group->get('/choresoverview', '\Grocy\Controllers\ChoresController:Overview');
|
||||||
$group->get('/choretracking', '\Grocy\Controllers\ChoresController:TrackChoreExecution');
|
$group->get('/choretracking', '\Grocy\Controllers\ChoresController:TrackChoreExecution');
|
||||||
$group->get('/choresjournal', '\Grocy\Controllers\ChoresController:Journal');
|
$group->get('/choresjournal', '\Grocy\Controllers\ChoresController:Journal');
|
||||||
@ -110,11 +93,8 @@ $app->group('', function (RouteCollectorProxy $group) {
|
|||||||
$group->get('/chore/{choreId}', '\Grocy\Controllers\ChoresController:ChoreEditForm');
|
$group->get('/chore/{choreId}', '\Grocy\Controllers\ChoresController:ChoreEditForm');
|
||||||
$group->get('/choressettings', '\Grocy\Controllers\ChoresController:ChoresSettings');
|
$group->get('/choressettings', '\Grocy\Controllers\ChoresController:ChoresSettings');
|
||||||
$group->get('/chore/{choreId}/grocycode', '\Grocy\Controllers\ChoresController:ChoreGrocycodeImage');
|
$group->get('/chore/{choreId}/grocycode', '\Grocy\Controllers\ChoresController:ChoreGrocycodeImage');
|
||||||
}
|
|
||||||
|
|
||||||
// Battery routes
|
// Battery routes
|
||||||
if (GROCY_FEATURE_FLAG_BATTERIES)
|
|
||||||
{
|
|
||||||
$group->get('/batteriesoverview', '\Grocy\Controllers\BatteriesController:Overview');
|
$group->get('/batteriesoverview', '\Grocy\Controllers\BatteriesController:Overview');
|
||||||
$group->get('/batterytracking', '\Grocy\Controllers\BatteriesController:TrackChargeCycle');
|
$group->get('/batterytracking', '\Grocy\Controllers\BatteriesController:TrackChargeCycle');
|
||||||
$group->get('/batteriesjournal', '\Grocy\Controllers\BatteriesController:Journal');
|
$group->get('/batteriesjournal', '\Grocy\Controllers\BatteriesController:Journal');
|
||||||
@ -122,30 +102,20 @@ $app->group('', function (RouteCollectorProxy $group) {
|
|||||||
$group->get('/battery/{batteryId}', '\Grocy\Controllers\BatteriesController:BatteryEditForm');
|
$group->get('/battery/{batteryId}', '\Grocy\Controllers\BatteriesController:BatteryEditForm');
|
||||||
$group->get('/batteriessettings', '\Grocy\Controllers\BatteriesController:BatteriesSettings');
|
$group->get('/batteriessettings', '\Grocy\Controllers\BatteriesController:BatteriesSettings');
|
||||||
$group->get('/battery/{batteryId}/grocycode', '\Grocy\Controllers\BatteriesController:BatteryGrocycodeImage');
|
$group->get('/battery/{batteryId}/grocycode', '\Grocy\Controllers\BatteriesController:BatteryGrocycodeImage');
|
||||||
}
|
|
||||||
|
|
||||||
// Task routes
|
// Task routes
|
||||||
if (GROCY_FEATURE_FLAG_TASKS)
|
|
||||||
{
|
|
||||||
$group->get('/tasks', '\Grocy\Controllers\TasksController:Overview');
|
$group->get('/tasks', '\Grocy\Controllers\TasksController:Overview');
|
||||||
$group->get('/task/{taskId}', '\Grocy\Controllers\TasksController:TaskEditForm');
|
$group->get('/task/{taskId}', '\Grocy\Controllers\TasksController:TaskEditForm');
|
||||||
$group->get('/taskcategories', '\Grocy\Controllers\TasksController:TaskCategoriesList');
|
$group->get('/taskcategories', '\Grocy\Controllers\TasksController:TaskCategoriesList');
|
||||||
$group->get('/taskcategory/{categoryId}', '\Grocy\Controllers\TasksController:TaskCategoryEditForm');
|
$group->get('/taskcategory/{categoryId}', '\Grocy\Controllers\TasksController:TaskCategoryEditForm');
|
||||||
$group->get('/taskssettings', '\Grocy\Controllers\TasksController:TasksSettings');
|
$group->get('/taskssettings', '\Grocy\Controllers\TasksController:TasksSettings');
|
||||||
}
|
|
||||||
|
|
||||||
// Equipment routes
|
// Equipment routes
|
||||||
if (GROCY_FEATURE_FLAG_EQUIPMENT)
|
|
||||||
{
|
|
||||||
$group->get('/equipment', '\Grocy\Controllers\EquipmentController:Overview');
|
$group->get('/equipment', '\Grocy\Controllers\EquipmentController:Overview');
|
||||||
$group->get('/equipment/{equipmentId}', '\Grocy\Controllers\EquipmentController:EditForm');
|
$group->get('/equipment/{equipmentId}', '\Grocy\Controllers\EquipmentController:EditForm');
|
||||||
}
|
|
||||||
|
|
||||||
// Calendar routes
|
// Calendar routes
|
||||||
if (GROCY_FEATURE_FLAG_CALENDAR)
|
|
||||||
{
|
|
||||||
$group->get('/calendar', '\Grocy\Controllers\CalendarController:Overview');
|
$group->get('/calendar', '\Grocy\Controllers\CalendarController:Overview');
|
||||||
}
|
|
||||||
|
|
||||||
// OpenAPI routes
|
// OpenAPI routes
|
||||||
$group->get('/api', '\Grocy\Controllers\OpenApiController:DocumentationUi');
|
$group->get('/api', '\Grocy\Controllers\OpenApiController:DocumentationUi');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user