Exercise: Securing Routes

In notebook:
Building Modern Web Apps
Created at:
2016-02-02
Updated:
2016-02-02
Tags:
libraries JavaScript React backend
There some urls that don't make sense when the user is not logged in (e.g. /repo/:owner/:name)

Suggest the easiest solution.
A helper function that would check authorisation in the router:
  // ****     router.js       ****
...
routes : {
    ...
    'repo/:owner/:name': requiresAuth('repoDetail'),
    ...
}
This is the concept. The challenge is to implement the requiresAuth function.