Set up dynamic requests to Enact
Routes allow incoming requests to Enact to be routed to specific actions, either a template or a controller, and allows for the parsing of tokens from the request uri based on conditions specified by the route.
Routes are define by a few fields:
Type – The HTTP request type, select 1 of 5:
ANY
GET
POST
PUT
DELETE
Slug – The request URI or slug for the route to match. Add tokens (variables) to be parsed from the slug by wrapping text in curly braces eg: /your-url/{var1}/{var2} and define how the token is used in matching by selecting one of the token types:
Integer - Matches only whole numbers.
Integer Positive - Matches only positive whole numbers.
Numeric - Matches only numbers.
Numeric Positive - Matches only positive numbers.
Alpha - Matches alpha characters, spaces, and dashes.
Alpha No Space - Matches only alpha characters and dashes.
Alpha Numeric - Same as Alpha but allows numbers.
Alpha Numeric No Space - Same as Alpha Numeric but does not allow spaces.
All - Matches anything, use carefully!
Custom - Define your own regular expression to be used for the match.
If you want to allow custom GET parameters, ie variables after a ? mark, specify them in your slug like /your-slug?{getVar1}&{getVar2} without the equal signs specifying values. The name of the variable will be interpreted as the GET variable name.
Action – What is executed when the route matches an incoming request uri:
Template – A template such as product/item.html to inject with the defined tokens.
Controller – A controller method combination such as Your\namespace\Controller@method which is to be executed and passed the routes token in the order they are defined.