Modified REST router to work nicely with AngularJS