Skip to content

Instantly share code, notes, and snippets.

@somebody32
Last active January 26, 2016 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save somebody32/33825a35470c804baf39 to your computer and use it in GitHub Desktop.
Save somebody32/33825a35470c804baf39 to your computer and use it in GitHub Desktop.
Initial Router
import Backbone from 'backbone';
import $ from 'jquery';
export default Backbone.Router.extend({
routes: {
'': 'home',
'main_app_part': 'mainAppPart',
'about': 'about',
'heavy(/:heavy_param)': 'heavy',
'*handleMissingRoute': 'handle404',
},
home() {
$('#app').html("You're on the home page");
},
mainAppPart() {
$('#app').html("You're viewing a part of the main app, it is lightweight and very actively used");
},
about() {
$('#app').html("You're viewing the about page. It is full of graphics");
},
heavy(heavy_param) {
$('#app').html(`You're viewing that heavy app, heavy param from the URL is: ${heavy_param}`);
},
handle404() {
alert('404');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment