Comments (9)
I think this is by design. Rails does basically the same.
from volt.
I don't think so, I understand that by design, the order of the routes is taken into account in the sense that the first match will be used (like Rails), but this is not the case here.
from volt.
@jaimeiniesta So this API might need a little more thought to make it intuitive. At the moment its by design, but your right, its not the most intuitive. Right now it matches top to bottom when going from params to a url. (and vice versa) get '/' matches anything, so it should be at the bottom.
from volt.
I'll leave this one open if anyone wants to discuss their thoughts on the routes. One of my goals with Volt is to have a simple routing system. Not needing to handle different http verbs allows us to simplify things. (Expect extra methods for building REST API's for the backend) I think the idea of routes just mapping params to urls and vice versa could make it easy to learn, but powerful enough to use day to day.
from volt.
Thanks for the explanation, in my opinion the best place for the root path is at the bottom, but I was surprised by this behavior.
Volt does not need to behave like Rails, but in Rails, you can have the root route on the top of the routes file and everything will still work as if it was at the bottom.
What I don't get is, why is it that get '/'
matches anything? In my opinion it should not match anything except exactly /
, I don't see any wildcard or optional parameter there.
I must surely be missing something about how routes are matched in Volt, but I can't find it in the docs.
from volt.
So front-end routing is a different thing than backend routing because you need to go from both url to params and params to url. So you can think of everything after the url string as constraints for matching.
get '/'
might be better written as get '/', {}
Something like ```get '/about', {_controller: 'about'}, only matches when the params._controller == 'about'
get '/'
matches any params. Maybe I should just make a root helper that just inserts its-self last.
Let me know if that makes since. Its simple, but maybe not intuitive enough. At this point all of these api's are open to change :-)
from volt.
Ah, alright, thanks a lot for your explanation!
get '/'
might be better written asget '/', {}
That was the point that I was missing :)
from volt.
Cool, thats a good idea. I'll add that.
On Sun, Sep 21, 2014 at 4:39 PM, Jaime Iniesta [email protected]
wrote:
Ah, alright, thanks a lot for your explanation!
get '/' might be better written as get '/', {}
That was the point that I was missing :)
—
Reply to this email directly or view it on GitHub
#43 (comment).
from volt.
I added some more stuff to the readme and generated routes.rb files. Hopefully that helps newcomers.
from volt.
Related Issues (20)
- Deployment with docker impossible, missing node.js HOT 3
- `config.try` doesn't work in the server? HOT 4
- How to use Volt::Boolean? HOT 2
- Following todos tutorial update does not work HOT 4
- DDP HOT 2
- Volt, Crawlers and SEO HOT 1
- Disable persistence layer (volt-mongo) on Volt HOT 2
- Volt Future related questions HOT 1
- Server won't start - broken dependency on listen / rb-inotifier gems HOT 1
- Server process doesn't actually stop
- I18n HOT 1
- Has this project been abandoned? HOT 18
- Volt Status HOT 1
- docs at voltframework.com/docs are only visible through a workaround
- Fork Volt HOT 6
- This project is dead? HOT 2
- Is this project definitely dead? HOT 1
- Reborn Volt
- "Connection lost..." smoth offline data and resync
- Link to Opal needs to be switched from .org to .com
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 volt.