How can I stop a user from accessing another route in a single page app directly in Backbone and Nodejs?

I am building an app that requires a login which if successful, passes you off to another page called events. However, Backbone works with the hash in the URL bar, therefore, the request that someone accessed that page is never sent to NodeJs Server.

The thing is, someone without login can access the page by just typing in http://www.mywebsite.com/#events

How can this be prevented?

Overwrite the 'execute' function in the backbone router.

From the docs:

router.execute(callback, args)

This method is called internally within the router, whenever a route matches and its corresponding callback is about to be executed. Override it to perform custom parsing or wrapping of your routes, for example, to parse query strings before handing them to your route callback, like so:

So, for example: (http://plnkr.co/edit/BqD4YfjQYz2RITWNhBKZ?p=preview)

  var Router = Backbone.Router.extend({
    execute: function(callback, args) {
        if(!someLoginFunctionCheck()) {
          this.navigate('#')
        } else {
          if (callback) callback.apply(this, args);
        }
      }
  });