Comments (1)
You can attach arbitrary default params to a route:
// define the route with default params
router.get('/posts/:id').to('posts.show', {lang:'en'} )
// resolve it later
router.first('/posts/5','GET')
//=> { controller: 'posts', action: 'show', id: 5, lang:'en' }
The original use case was defining defaults for route segments:
router.get('/posts/:id(.:format)').to('posts.show', {format:'pdf'} )
router.first('/posts/5','GET')
//=> { controller: 'posts', action: 'show', id: 5, format:'pdf' }
router.first('/posts/5.html','GET')
//=> { controller: 'posts', action: 'show', id: 5, format:'html' }
but you could use it for whatever you want I guess...
Although I have no idea what you're doing specifically, specifying a view in the route seems like The Wrong Thing To Do™
from barista.
Related Issues (20)
- broken mixin helper for deep copy HOT 3
- Add request header routing HOT 2
- Calling router.first method would return false when it takes URL which contains %20s ( spaces ) HOT 2
- What about Strict Mode? HOT 2
- Error in barista 0.10 HOT 18
- Need stable release branch for submitting bugfixes HOT 1
- Id parameter can not content dots HOT 1
- What license is Barista? HOT 2
- Add namespace support
- Limiting the methods of the Resource class HOT 1
- Customizing Resources
- wrong documentation
- Generate url by name HOT 3
- Add support for HTTP PATCH method HOT 2
- How to route single static files HOT 5
- Allow extra_params to be passed to .resource() HOT 2
- Match periods with a glob HOT 2
- Redirects HOT 1
- barista does not support a "bare" route HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from barista.