aurelia / router

A powerful client-side router.
MIT License
121 stars 115 forks source link

Using URI Template (RFC 6570) #212

Closed heruan closed 8 years ago

heruan commented 9 years ago

RFC 2560 defines a URI Template syntax widely used in RESTful frameworks (e.g. JAX-RS, Restlet, Symphony).

The syntax of routes changes slightly, i.e. /user/:id would become /user/{id} but there are many syntax options for matching the correct route (see the RFC).

There already exist JavaScript plugins to handle them (uri-template, uri-templates, url-template).

Why not using URI Template in Aurelia's router?

EisenbergEffect commented 9 years ago

I think this is a nice idea...however, as far as I can tell, all the linked libraries are focused on expanding the templates rather than pattern matching, which is what the router does mostly. So, we would need to write an entirely new matcher to support this change.

Since we hope to have the beta out in about 3 weeks, I don't think there's going to be time to do something like that. Especially considering this would be a massive breaking change.

@bryanrsmith You can comment further. Perhaps there is a way that we can use DI and some abstraction to allow our route recognizer to be swaped out. Right now we instantiate that directly, but maybe we should have a factory that can create instances of those and configure them? Then @heruan could replace it with his own. My guess is that this could be done post-beta without breaking anything. What do you think?

bryanrsmith commented 9 years ago

Yeah, we can do that after beta without breaking anything. We can probably even factor out just the bits that care about syntax, too, so the matching & generation logic doesn't need to be reimplemented.

I agree that it's too big a breaking change. The rails style syntax is much more common in route patterns anyways. On Mon, Sep 14, 2015 at 6:03 AM Rob Eisenberg notifications@github.com wrote:

I think this is a nice idea...however, as far as I can tell, all the linked libraries are focused on expanding the templates rather than pattern matching, which is what the router does mostly. So, we would need to write an entirely new matcher to support this change.

Since we hope to have the beta out in about 3 weeks, I don't think there's going to be time to do something like that. Especially considering this would be a massive breaking change.

@bryanrsmith https://github.com/bryanrsmith You can comment further. Perhaps there is a way that we can use DI and some abstraction to allow our route recognizer to be swaped out. Right now we instantiate that directly, but maybe we should have a factory that can create instances of those and configure them? Then @heruan https://github.com/heruan could replace it with his own. My guess is that this could be done post-beta without breaking anything. What do you think?

— Reply to this email directly or view it on GitHub https://github.com/aurelia/router/issues/212#issuecomment-140064397.

bryanrsmith commented 8 years ago

Closing for now.