j_quelly
j_quelly

Reputation: 1449

Difficulty deploying lumen app

I'm trying to deploy a small application to my remote server, however, I seem to be having difficulty with some of the routes. Bare in mind that everything works on my local machine.

Here is what I've done:

  1. Uploaded the entire project to /home/user/app
  2. Moved contents of /home/user/app/public to /home/user/public_html/api
  3. Modified /home/user/public_html/api/index.php from:

$app->run();

to

$request = Illuminate\Http\Request::capture();
$app->run($request);

...this allowed my first route to work, but I cannot load any other routes such as:

http://www.mywebsite.com/api/v1/book

Please note that only http://www.mywebsite.com/api is the only route that loads correctly.

My routes.php looks like this:

$app->get('/', function() use ($app) {
    return "Lumen RESTful API";
});

$app->group(['prefix' => 'api/v1','namespace' => 'App\Http\Controllers'], function($app)
{
    $app->get('book','BookController@index');

    $app->get('book/{id}','BookController@getbook');

    $app->post('book','BookController@createBook');

    $app->put('book/{id}','BookController@updateBook');

    $app->delete('book/{id}','BookController@deleteBook');
});

My .htaccess is as follows:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

The error I am receiving:

The error I am receiving

Let me know if you need any more information?

Any help would be greatly appreciated!

Upvotes: 1

Views: 1861

Answers (1)

Angad Dubey
Angad Dubey

Reputation: 5452

Change route group prefix to:

$app->group(['prefix' => 'v1'

Upvotes: 2

Related Questions