Closed chhuang closed 7 years ago
I think it's correct but I the information which I understand.
Choices :
- routes.add(name, pattern = /name, page = name)
- routes.add(pattern, page)
Case :
- routes.add('blog', '/blog/:slug')
- will be mapped to the 1st choice and page = name by default.
- routes.add('user', '/user/:id', 'profile') will be mapped to choice 1
- will be mapped to the 1st choice and page = profile
- routes.add('/:noname/:lang(en|es)/:wow+', 'complex')
- will be mapped to the 2nd choice and page = complex
If any wrong, Let's discuss!
Thanks @nuttikung that's all correct!
In the first example:
routes.add('blog', '/blog/:slug')
, the first argument is the page and the second is the pattern.But then under
API:
:routes.add(pattern, page)
, should that beroutes.add(page, pattern)
instead?