Route
Will add the necessary routing config to the routes file in the config folder and optionally create the corresponding Controller file with its index.
Example
tramway create:route ProductController getOne /products --methods get --args id --create-controller
Options
Argument | Command Type | Type | Default | Required | Comments |
---|---|---|---|---|---|
controller | argument | string | none | yes | The name of the Controller class associated to the route |
action | argument | string | none | yes | The name of the method in the Controller class associated to the route |
path | argument | string | none | no | The url path of the route |
methods | option | array | none | no | An array of http methods the route accepts |
args | option | array | none | no | An array of arguments the url accepts |
create-controller | option | boolean | false | no | A flag set to indicate a Controller and corresponding function stub should be generated by the command |
dir | option | string | config | no | An option to override the default folder the routing config will be placed in |
controller-dir | option | string | controllers | no | An option to override the default folder where controllers are stored |
filename | option | string | routes | no | An option to override the default name of the routing config file |