Skip to main content

Module generate_routes

Module generate_routes 

Source
Expand description

Route generation for type-safe frontend integration

Generates TypeScript route helpers compatible with Inertia.js v2+ UrlMethodPair interface. This allows type-safe navigation with:

  • router.visit(controllers.user.show({ id: '123' }))
  • form.submit(controllers.todo.store({ title: 'Task', completed: false }))
  • <Link href={controllers.user.index()}>Users</Link>

Structs§

FormRequestField
FormRequestStruct
A form request struct definition
GeneratedRoute
A complete route ready for TypeScript generation
HandlerInfo
Information about a handler function
PathParam
A path parameter extracted from route patterns like /users/{id}
RouteDefinition
A parsed route definition from routes.rs
RouteJson
Single route entry in RoutesJson.
RoutesJson
Stable JSON schema for ferro generate-routes --json (D-10..D-12).

Enums§

HttpMethod
HTTP methods for routes
RustType
Rust type representation for TypeScript conversion

Functions§

generate_json_string
Scan routes and serialize to a pretty JSON string.
generate_routes_to_file
Generate routes and write to the output file
generate_typescript
Generate TypeScript routes file
parse_routes_file
Parse routes.rs file content and extract route definitions
routes_to_json
Convert scanned routes into the stable RoutesJson schema.
run
Main entry point for route generation (standalone use)
run_json
Entry point for ferro generate-routes --json. Prints to stdout, exits non-zero on error.
scan_routes
Scan routes and handlers to build GeneratedRoute list