0

I am developing an website with simple landing, news and contact as frontend (using php is more that sufficient enough.. vuejs would be overkill...) and vue js as backend. Trying to send all request from /admin/* to view('admin'), this is the best I could come up with:

Route::prefix('admin')->group(function () {
   Route::any('{query}', function() {
       return view('admin');
   })->where('query', '.*');
});

In route:list, it seems listed well and (with hope) it should works to. But what I get was 404 - not found (standard laravel errorpage which I hope was supposed to be handled by vuejs and not laravel since it was in the back end. No error recorded at all in apache log and neither in laravel log. Where did I do wrong?

//This project was basically done in lumen but lumen had the same problem. Tried it with laravel since laravel was the father of lumen, but seems to have same response. Am I missing something?

Webidew
  • 1
  • 1

1 Answers1

0

Whole web.php as below:

Route::get('/', 'LandingController@index');
Route::get('/news', 'PostController@index');
Route::get('/news/{id}', 'PostController@index');
Route::post('/news/{id}/addcomment', 'CommentController@store');
Route::get('/news/{id}/comment/{id}/edit', 'CommentController@edit');
Route::put('/news/{id}/comment/{id}', 'CommentController@update');
Route::delete('/news/{id}/comment/{id}', 'CommentController@destroy');
Route::get('/contact', 'ContactController@index');
Route::get('/contact/location', 'ContactController@sendlocation');

Route::prefix('admin')->group(function () {
    Route::any('/{query}/', function () {
        return view('admin');
    })->where('query', '.*');
});

What I'm trying to archive here is so that my admin section was totally handled by vue.js since it was a complete office app that handled most job. Most probably will be in form of PWA (currently still multipage app and still under heavy development).

Since some customer just want to browse around without using the app, it is pointless for them to download the whole app just to browse the news or any simple to get information. But using the app itself is another story.

So... the plan was to let landing, news and contact page remains as normal html page. Only admin section will be in vue.js.

Webidew
  • 1
  • 1