Open
Description
The hack that is applied to stop route caching is not just hacky, it very hacky and way too inelegant. There is much simpler solution which I believe should have an been obvious choice.
Instead of blocking the caching of routes by doing this:
$router->any('* routes should not be cached',[
'as' => 'routes-should not be cached',
'uses' => function () { return 'Api-tester routes-should not be cached';},
]);
Just simply register the route conditionally in RouteServiceProvider
according to APP_DEBUG
value, like so:
public function map(Router $router)
{
if(config('api-tester.enabled')) {
$router->group([
'as' => 'api-tester.',
'prefix' => config('api-tester.route'),
'namespace' => $this->getNamespace(),
'middleware' => $this->getMiddleware(),
], function () {
$this->requireRoutes();
});
}
}
Metadata
Metadata
Assignees
Labels
No labels