Why did you alter your index.php file? Your routes should be in you api.php file.
Jun 19, 2018
4
Level 1
Deploying laravel project
I'm trying to deploy my project on a server, Its a RESTAPI. the server is running apache and is working properly (I tested it with a hello world script).
My project itself is in /var/API.
I've moved my public folder from my project to my document root (/var/www/).
I've altered my index.php document from my laravel project and added it to my document root, along with my public/.htaccess. The problem I'm having lies in my altered index.php file posted below.
If I run a get API call i get a 404 error in my browser. If I just run the ip for the server itself I get a 500 error.
<?php
define('LARAVEL_START', microtime(true));
require __DIR__.'/var/API/vendor/autoload.php';
$app = require_once __DIR__.'/var/API/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);
Please or to participate in this conversation.