joseantoniopino / bloonde

0 stars 0 forks source link

[Error] The route $anyRoute could not be found. #1

Open jmunozdev opened 1 month ago

jmunozdev commented 1 month ago

After a clean and smooth new install, when trying to use any of the postman methods provided, i'm getting the "The route customers could not be found." It happens with every single route provided.

I am using http://localhost:8000 as {{env}} variable for postman.

Full trace here:

{ "message": "The route customers could not be found.", "exception": "Symfony\Component\HttpKernel\Exception\NotFoundHttpException", "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php", "line": 44, "trace": [ { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php", "line": 162, "function": "handleMatchedRoute", "class": "Illuminate\Routing\AbstractRouteCollection", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 763, "function": "match", "class": "Illuminate\Routing\RouteCollection", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 750, "function": "findRoute", "class": "Illuminate\Routing\Router", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 739, "function": "dispatchToRoute", "class": "Illuminate\Routing\Router", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 200, "function": "dispatch", "class": "Illuminate\Routing\Router", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 144, "function": "Illuminate\Foundation\Http\{closure}", "class": "Illuminate\Foundation\Http\Kernel", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 21, "function": "Illuminate\Pipeline\{closure}", "class": "Illuminate\Pipeline\Pipeline", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php", "line": 31, "function": "handle", "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 21, "function": "Illuminate\Pipeline\{closure}", "class": "Illuminate\Pipeline\Pipeline", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php", "line": 51, "function": "handle", "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\Foundation\Http\Middleware\TrimStrings", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php", "line": 27, "function": "Illuminate\Pipeline\{closure}", "class": "Illuminate\Pipeline\Pipeline", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\Http\Middleware\ValidatePostSize", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php", "line": 110, "function": "Illuminate\Pipeline\{closure}", "class": "Illuminate\Pipeline\Pipeline", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php", "line": 49, "function": "Illuminate\Pipeline\{closure}", "class": "Illuminate\Pipeline\Pipeline", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\Http\Middleware\HandleCors", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php", "line": 57, "function": "Illuminate\Pipeline\{closure}", "class": "Illuminate\Pipeline\Pipeline", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\Http\Middleware\TrustProxies", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 119, "function": "Illuminate\Pipeline\{closure}", "class": "Illuminate\Pipeline\Pipeline", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 175, "function": "then", "class": "Illuminate\Pipeline\Pipeline", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 144, "function": "sendRequestThroughRouter", "class": "Illuminate\Foundation\Http\Kernel", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php", "line": 1188, "function": "handle", "class": "Illuminate\Foundation\Http\Kernel", "type": "->" }, { "file": "/var/www/html/public/index.php", "line": 17, "function": "handleRequest", "class": "Illuminate\Foundation\Application", "type": "->" } ] }

joseantoniopino commented 1 month ago

If you want to use http://localhost:8000 you will have to modify the following:

in the .env:

APP_URL=http://localhost
APP_PORT=8000

(although it always gives me a lot of trouble changing the port this way once I have lifted the container for the first time, I guess it's a cache thing.)

I remind you that the path for all the API endpoints is /api/v1.

For example, the route to create a customer would be: (assuming you have changed those two environment variables in the .env)

(POST) http://localhost:8000/api/v1/customers

If you don't want to change anything in the .env, go to your /etc/hosts file and add:

127.0.0.1 bloonde.test

With this, you will get the routes to work this way:

(POST) http://bloonde.test/api/v1/customers

Try and tell me!