How to create a dynamic URL using Meteor?

I am new to web design and was shocked by the demo on the Meteor website and would like to use it. So far I have been using the Google App Engine and handling a dynamic URL in the main class, I would write something like this:

app = webapp2.WSGIApplication([('/[0-9]', HandlePost)], debug=True)

This would match any URL with numbers from 0 to 9 at the end of a handler class that would load an HTML page with the appropriate data for the page using a template engine such as steering wheels.

How do I do something like this in Meteor?

+5
source share
2 answers

, . http://backbonejs.org/#Router-routes
, , . http://blog.rjzaworski.com/2011/12/regex-routing-with-backbone-js/
todo , . client/todo.js:

////////// Tracking selected list in URL //////////

var TodosRouter = Backbone.Router.extend({
  routes: {
    "todo_list/:list_id": "main"
  },
  main: function (list_id) {
    Session.set("list_id", list_id);
    Session.set("tag_filter", null);
  },
  setList: function (list_id) {
    this.navigate("todo_list/"+list_id, true);
  }
});

Router = new TodosRouter;

Meteor.startup(function () {
  Backbone.history.start({pushState: true});
});
+5

Backbone- Meteor Router. , , .

+3

All Articles