Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] Routes Api not found #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
evolucionaurea opened this issue Nov 6, 2023 · 6 comments
Closed

[BUG] Routes Api not found #305

evolucionaurea opened this issue Nov 6, 2023 · 6 comments

Comments

@evolucionaurea
Copy link

Hi, Good day!

1) I followed all the installation steps.
If I enter here I see this:
http://127.0.0.1:8000/request-docs
image
I think it's going to welcome.blade.php

2) If I enter here I see this:
http://127.0.0.1:8000/request-docs/api
image

More info:

kernel.php:

'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\ldap::class,
\Rakutentech\LaravelRequestDocs\LaravelRequestDocsMiddleware::class,
],

Config/request.docs.php:

true, // change it to true will make lrd to throw exception if rules in request class need to be changed // keep it false 'debug' => false, /* * Route where request docs will be served from laravel app. * localhost:8080/request-docs */ 'url' => 'request-docs', // Por defecto: request-docs 'middlewares' => [ // \Rakutentech\LaravelRequestDocs\NotFoundWhenProduction::class, ], //Use only routes where ->uri start with next string Using Str::startWith( . e.g. - /api/mobile 'only_route_uri_start_with' => '', 'hide_matching' => [ '#^telescope#', '#^docs#', '#^request-docs#', '#^api-docs#', '#^sanctum#', '#^_ignition#', '#^_tt#', ], 'hide_meta_data' => false, 'hide_sql_data' => false, 'hide_logs_data' => false, 'hide_models_data' => false, // https://github.com//pull/92 // When rules are put in other method than rules() 'rules_methods' => [ 'rules' ], // Can be overridden as // @LRDresponses 200|400|401 'default_responses' => [ "200", "400", "401", "403", "404", "405", "422", "429", "500", "503"], // By default, LRD group your routes by the first /path. // This is a set of regex to group your routes by prefix. 'group_by' => [ 'uri_patterns' => [ '^api/v[\d]+/', // `/api/v1/users/store` group as `/api/v1/users`. '^api/', // `/api/users/store` group as `/api/users`. ] ], // No need to touch below // open api config // used to generate open api json 'open_api' => [ 'title' => 'Laravel Request Docs', 'description' => 'Laravel Request Docs', // default version that this library provides 'version' => '3.0.0', // changeable 'document_version' => '1.0.0', // license that you want to display 'license' => 'Apache 2.0', 'license_url' => 'https://www.apache.org/licenses/LICENSE-2.0.html', 'server_url' => env('APP_URL', 'http://localhost'), //openapi 3.0.x doesn't support request body for delete operation //ref: https://github.com/OAI/OpenAPI-Specification/pull/2117 'delete_with_body' => false, //exclude http methods that will be excluded from openapi export 'exclude_http_methods' => [], // for now putting default responses for all. This can be changed later based on specific needs 'responses' => [ '200' => [ 'description' => 'Successful operation', 'content' => [ 'application/json' => [ 'schema' => [ 'type' => 'object', ], ], ], ], '400' => [ 'description' => 'Bad Request', 'content' => [ 'application/json' => [ 'schema' => [ 'type' => 'object', ], ], ], ], '401' => [ 'description' => 'Unauthorized', 'content' => [ 'application/json' => [ 'schema' => [ 'type' => 'object', ], ], ], ], '403' => [ 'description' => 'Forbidden', 'content' => [ 'application/json' => [ 'schema' => [ 'type' => 'object', ], ], ], ], '404' => [ 'description' => 'Not Found', 'content' => [ 'application/json' => [ 'schema' => [ 'type' => 'object', ], ], ], ], '422' => [ 'description' => 'Unprocessable Entity', 'content' => [ 'application/json' => [ 'schema' => [ 'type' => 'object', ], ], ], ], '500' => [ 'description' => 'Internal Server Error', 'content' => [ 'application/json' => [ 'schema' => [ 'type' => 'object', ], ], ], ], 'default' => [ 'description' => 'Unexpected error', 'content' => [ 'application/json' => [ 'schema' => [ 'type' => 'object', ], ], ], ], ], ], //export request docs as json file from terminal //from project root directory 'export_path' => 'api.json' ]; _**In routes/api.php I have the routes. Example:**_ Route::get('clientes', [ClientesController::class, 'index']); Route::post('clientes', [ClientesController::class, 'store']); Route::get('clientes/{id}/edit', [ClientesController::class, 'edit']); Route::put('clientes/{id}', [ClientesController::class, 'update']); Route::delete('clientes/{id}', [ClientesController::class, 'destroy']); **_In routes/web.php:_** I have welcome.blade.php only **_In Public:_** I have index.html and _astro **Question** Can you help me? I need to see the API routes
@shravanjha
Copy link

What was the fix?
I am seeing the same error.

@kevincobain2000
Copy link
Member

Can’t understand your issue. Sorry.

@shravanjha
Copy link

image

@shravanjha
Copy link

image

@shravanjha
Copy link

image

php artisan laravel-request-docs:export
Error : Method App\Http\Controllers\API\BookingController::action() does not exist

php artisan route:list command works and show all endpoints
@kevincobain2000, Can you please help me to solve this issue?
I am stuck with this for many days.

@shravanjha
Copy link

I am able to export the api.json now and use it in postman using below command.
php artisan laravel-request-docs:export

But still having 404 not found issue for request-docs/api and request-docs/config so can't view it in browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants