0

I am trying to implement a laravel API using octane for the increased performance, and im now trying to use the Octane::route to pull back data from my database in my api.php file and i keep getting an error, i am running my tests using postman to hit the endpoint. I am still learning how this all works and would love for some guidance.

route code:


use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Laravel\Octane\Facades\Octane;

use App\Models\User;
use App\Http\Controllers\UserController;
use Symfony\Component\HttpFoundation\Response;

Octane::route('GET', '/users', function(){
    return response()->json([
        'data' => \App\Models\User::all()
    ]);
});

error:

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: The GET method is not supported for this route. Supported methods: POST. in file /home/forge/techgate-api-staging-1.chargenation.io/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php on line 118
Dath
  • 29
  • 3
  • As I searched and saw the laravel document, in laravel octane route signatures don't have any difference with simple laravel, have you tried route signatures in a simple way, and if you tried it, have you got this error too? – Amir Abouei Apr 13 '22 at 21:08
  • as it stands, i dont even know what a simple one would look like, like i said im still learning and this was the way the routing was displayed in the tutorial. are you able to give me an example i could try and then i can let you know. – Dath Apr 13 '22 at 22:57

0 Answers0