spaspec / spaspec-standard

Static Page Application Specification Standard
Creative Commons Zero v1.0 Universal
3 stars 0 forks source link

Route directives #8

Open stuartpb opened 8 years ago

stuartpb commented 8 years ago

Right now, only lines that start with a / are treated as route specifiers. Earlier drafts of this entertained the idea of allowing relative paths to be specified by not leading with a / (the way browsers treat them).

I'm now definitively against the idea of making paths acceptable when not starting with /: keeping letters-at-the-beginning-of-the-line as a reserved namespace opens the door for some kind of expansion like include directives, using just the keyword.

Of course, I don't think this spec should ever actually have include directives (if you want to make a framework that modularizes its routing, just have it process those modules into a _spaspec/routes when building/deploying), but it's a smart namespace to reserve nonetheless.

(On this same note: // at the start of a path will probably be for host-based routes, and, in the unlikely event /**/ is ever insufficient for global routing and there needs to be some kind of "relative" route specifier, ./ will do fine. That'd probably be what said modular routing compiler would use, actually.)

stuartpb commented 8 years ago

@sintaxi makes a good point about restricting routes based on requested MIME type: this might be a sensible case for a directive.

stuartpb commented 8 years ago

Actually, since it's just a component of the match, I think there's an uglier but more sensible solution here than directives - I'll file a new issue.