I built a single page web app with vue js as the front-end library and laravel as the back-end framework. Its now time to host it on a shared hosting service and have not found any clear steps on how to do this successfully with the Api Routes of the loading as programmed.
I copied content of laravel public folder and build files of vue js to the public_html folder in shared hosting. Then it's loading the frontend without data from the backend. Should I have to use two separate ip addresses for backend and frontend or is it possible to use same shared hosting storage for deploy my Vue js frontend and laravel backend(api routes).
//index.php of laravel
<?php
require __DIR__.'/../jewelpack_app/vendor/autoload.php';
$app = require_once __DIR__.'/../jewelpack_app/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
?>
//web.php of laravel routes
<?php
Route::get('/{any}', function(){
return view('index');//pointing to the index file of the frontend
})->where('any', '.*');
?>
Actually problem was with the my domain. I used my tempory webpage url for the hosting process. After I register my domain it all works fine. Thanks!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With