Add a controller and route
add-controllerGenerate routes.xml plus GET page or POST JSON controller files, with layout handle, template, and Admin ACL for frontend or adminhtml modules. Returns files for you to write.
Instructions
Generate routes.xml, an action controller (GET page or POST JSON) and, for pages, the layout handle and template, for the frontend or adminhtml area (with ADMIN_RESOURCE and acl.xml for the Admin), adapted from the official routing docs. Returns the files for the caller to write.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| area | Yes | frontend (storefront) or adminhtml (Admin) | |
| title | No | Page title for GET actions | |
| action | No | Action class (default "Index") | |
| method | No | HTTP method: GET renders a page with a layout handle, POST returns JSON (default GET) | |
| module | Yes | Module name as Vendor_Module (e.g. "Acme_Reviews"), as registered in registration.php | |
| routeId | No | Route id in routes.xml and first part of the layout handle (default: frontName) | |
| basePath | No | Module directory relative to the Commerce root (default "app/code/<Vendor>/<Module>") | |
| frontName | Yes | URL front name: the first URL segment, <frontName>/<controller>/<action> (e.g. "reviews") | |
| controller | No | Controller folder (default "Index") | |
| aclResource | No | adminhtml only: ACL resource for ADMIN_RESOURCE (default "<Vendor_Module>::<controller>") |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | Files to write. The server never writes to disk. | |
| notes | Yes | Next steps and caveats |