Friday, March 9, 2018

How to deploy an Laravel 5.4 API and Vue.js 2 project? - development

How to deploy an Laravel 5.4 API and Vue.js 2 project?

I have created an API using Laravel 5.4 and frontend side using Vue.js 2 on different domains. Installed CORS to an API. By this time it all works correctly in my local machine. How should I deploy it in a proper way to a hosting server? I have 2 folders: backend and frontend. In there I’ve implemented 2 separate projects: one is an API and the other one is a frontend side.

Here’s my routes/api.php

Route::group(['middleware' => ['jwt.auth']], function() {    
    Route::get('logout', 'AuthController@logout');
    Route::get('/requests', 'RequestController@index');
    Route::delete('/requests/{id}', 'RequestController@destroy');
});

Route::post('login', 'AuthController@login');
Route::post('register', 'AuthController@register');


Route::post('/requests', 'RequestController@create');

Route::get('/', function() {
    return response()->json([
        'success' => true
    ]);
});

Route::get('/hello', function() {
    return response()->json([
        'success' => true,
        'message' => 'API is working correctly.'
    ]);
});



from Laravel Questions and Answers https://laravelquestions.com/laravel/how-to-deploy-an-laravel-5-4-api-and-vue-js-2-project/
via Lzo Media

No comments:

Post a Comment