Issues with route.js (routing function used in the Javascript Address Book Sample App

Hello everyone! Hope you’re all having a tremendous day.

I’ve been developing web apps and following some of the code from the Javascript Address Book sample app. In that SDK, there is a javascript route.js file that handles the routing for the single-page web app. I like this structure for routing a web app because I don’t want to program using a routing framework such as AngularJS for this particular application.

I’ve had some success using the route function, however, it’s very hit or miss. In some applications it works, in others, it does not. And often times, when I want to add a page or a route, it falls apart, and I have no idea why. Specifically, when I try to route to another part of my application, the page it routes to will be completely blank when I know there is HTML to be displayed in that template. The function seems to work for the main ‘index’ route, but all other routes it just displays a blank page.

In debugging this issue myself for the past few weeks, I find that I simply do not know enough about Regular Expressions (regexp) in javascript and HTML and what’s happening to cause a page to be blank.

So I figured I’d put it out on the airwaves and see if anyone has experience with this or is willing to help. It’s particularly frustrating because I believe it may have something to do with the regexp and the URL, of which I have little experience. I understand this is more of a Javascript question, but there isn’t a whole lot out there on custom-built routing functions based on pure javascript alone.

Thanks for any help anyone can provide!