-
Notifications
You must be signed in to change notification settings - Fork 28
Routing
Brian Zou edited this page Mar 6, 2019
·
7 revisions
Basic rule
#
# [GET,POST,PUT...] path controller.method
#
Example:
GET / index.index
GET /users user.list
GET /user/{id} user.detail
GET /user/{id<\d+>} user.detail
- The path is unique
The defined path cannot be ambiguous
#The following entry conflicts
* /home index.show
GET /home index.index
- Default static path
/
The Router automatically adds the following routes according to the situation. By default, the wwwroot
directory is used as the static file path.
GET / staticDir: wwwroot
- Index file search
If the routing path does not exactly match the Action method on the Controller, go to Search for a static file with the file format path + default static file
. The default static file is as follows:
Index.html, index.htm, default.html, default.htm, home.html
Default route config file is:
config/routes
If you want use advanced method, allow bind domain & directory go to config/application.conf find this option:
route.groups = admin:path:admincp, api:domain:api.example.com
You have create groups config files:
config/admin.routes
config/api.routes