![]() |
NanoFramework 1.4.0
A tiny PHP Framework
|
Each line of the file represents a rule and is composed in 5 parts:
:
->
The method can be:
get
, post
, put
, delete
get,post
all
, equivalent to get,post,put,delete
The requested URI can be any URI, expressed in RegEx. Two placeholders can be used for readability:
:segment
represents a URI segment (a part between two /
):any
represents one or more segmentsParentheses can be used to capture parts of the URI.
The target URI must correspond to a Controller. It must have the syntax controller/method/params
. If params
is missing, no parameters will be sent to the method. If method
is missing, index
will be used.
Placeholders such as $1
, $2
, etc. can be used to display the captured parentheses in the RegEx.
Comments can be added in the file. They start with a #
and can either be on their own line or at the end of a line.
Blank lines can also appear in the file.
Here is an example of a valid routes
file. Note that the whitespaces is optional and only present to improve readability.