I want to make kind of api for static files with versioning in such way:
public/js
public/js
├ script-1.1.js
├ script-1.2.js
├ ...
└ script-2.1.js
routes/web.php
Route::get('/js/{version}/script.js', function ($version) {
return File::get(public_path() . '/js/script-'.$version.'.js');
})->where('version', '^\d+(\.\d+)*$');
The problem is that Laravel ignores this route anyway and trying to find static file.
I.e. this will return 404 page:
Route::get('/js/test/script.js', function() {
return response('Echo', 200)
->header('Content-Type', 'text/plain');
});
But this will return 'Echo':
Route::get('/js/test', function() {
return response('Echo', 200)
->header('Content-Type', 'text/plain');
});
How to perform routing on URL which has filename in the end? I can't find similar issues still or any examples.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/34Fok3a
via IFTTT
Aucun commentaire:
Enregistrer un commentaire