Skip to content

resolveLaravelRoutes

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/libs/parser-core/src/techdocs/cross-file-routes.ts

Mount Laravel route files where the application actually mounts them.

routes/api.php is served under /api by convention, and the Laravel parser applies that so a standalone parse is usable. But the convention is only a DEFAULT: the real prefix is stated in RouteServiceProvider (Route::prefix('api/v2')->group(base_path(…))) or, since Laravel 11, in bootstrap/app.php (withRouting(apiPrefix: …)). Where that file is in the parse and disagrees, it wins — it is the application speaking rather than a guess about it.

Endpoints whose route file is never mounted keep the convention path rather than losing it; an app that splits routes into files a provider loads dynamically is common, and dropping every one of its endpoints is worse than a prefix that matches the framework default.

Signature

ts
function resolveLaravelRoutes(entities: Entity[]): number

Parameters

NameType
entitiesEntity[]

Returns: number

Was this page helpful?

Download as PDF