Skip to content
This repository

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

Closed
DonkeyHot opened this Issue April 12, 2012 · 6 comments

3 participants

Dmitrii Charlie Robbins
Dmitrii

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.

Charlie Robbins
Owner

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

Dmitrii

@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 commented May 05, 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')

Charlie Robbins
Owner

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

Marak commented July 23, 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 closed this July 23, 2012
Charlie Robbins
Owner

@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
Something went wrong with that request. Please try again.