Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-side: Route '/post' doesn't mount #91

Closed
ghost opened this issue Apr 12, 2012 · 6 comments
Closed

Server-side: Route '/post' doesn't mount #91

ghost opened this issue Apr 12, 2012 · 6 comments

Comments

@ghost
Copy link

ghost commented Apr 12, 2012

Route "/post" and it's derivatives like "/post/:id" doesn't mount, if post method for front page is already binded.

This happens after "isArray" check at router.js:579.

@indexzero
Copy link
Member

@donkeyhot Can you provide some sample usage which shows this issue?

@ghost
Copy link
Author

ghost commented Apr 25, 2012

@indexzero
Suppose, this chunk of code will clearly describe the situation.

var flatiron = require('flatiron')
  , app = flatiron.app;

app.use(flatiron.plugins.http);

app.router.get('/', function() {
  this.res.text('Index get');
});

app.router.post('/', function() {
  this.res.text('Index post');
});

app.router.get('/post/', function() {
  this.res.text('Post get');
});

app.listen(3000);

@Marak
Copy link
Contributor

Marak commented May 5, 2012

I've hit this same behavior when attempting to make a similar combination.

My particular problem was with router.delete and router.post('/delete')

@indexzero
Copy link
Member

Hmm ... this is indeed a bug. Not quite sure how to disambiguate these in the router table.

@Marak
Copy link
Contributor

Marak commented Jul 24, 2012

Upon further inspection, I'm starting to consider this a feature.

Having this restriction allows for easier introspection of the routing table itself, as you can easily distinguish between what is a route name versus a verb.

This shouldn't be changed unless there is a major refactor of the internal routing table that allows for bindable metadata on routes.

@Marak Marak closed this as completed Jul 24, 2012
@indexzero
Copy link
Member

@Marak Yeah, it would take a complete overhaul of the internal data structure to disambiguate the metadata from verbs and also from other partial-paths in the routing table.

Worth considering, but never-the-less a lot of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants