Lazy Routes learned from Sinatra Routes!
\Sloths\Application\Application
.
So every properties, methods of the context is available within the callback handler.
Routes are matched in the order they are defined.
The first route that matches the request is invoked
unless you call pass()
within the route callback, the process will be matching the next route.
Route patterns can be static pattern:
Or includes named parameters:
Or named parameters with double colon:
Or Includes wildcard parameters:
Or With Regular Expressions: (Regex pattern should start with #
character)
Route patterns may have optional parameters:
Most commonly, this is a string. But other values are also accepted.
The return values will be send to response body. It mean if return values is an array or object,
the response object will be send it as json string and the content type header is application/json
.
application\routes\posts.php