Skip to content

Comment on Backbone.js adds Controllers and Historyparent

Comments

Just a nit: is that "search/:query/:page"?

You could do either, but in this case, I'm going for URLs like:

    example.com/#search/washington+news/p10
... to make it a bit more obvious that the number at the end is a page number. This is actually a real-world example -- it's the same route that DocumentCloud uses to run searches in the workspace.

I don't think so, "example.com/#search/lemons/p7" would route to search("lemons", "7").

Actually, why use colons instead of URI templates?

http://tools.ietf.org/html/draft-gregorio-uritemplate-04

Hey, that's a great idea. I've been following the progress of that draft a good bit, and we're already using URI-templates as part of the DocumentCloud API...

    "image":"http://s3.dcloud.org/docs/101/pages/inauguration{page}-{size}.gif"
I'd be a bit concerned if we used them in Backbone, that we wouldn't be following the spec by parsing all variants of the expansions -- but on balance, it's probably a great thing to do.

Cool. We use a URL patterns variant in Midgard MVC, so that should make Backbone integration easier :-)

http://github.com/bergie/midgardmvc_core

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.