Book Image

JavaScript at Scale

By : Adam Boduch
Book Image

JavaScript at Scale

By: Adam Boduch

Overview of this book

Table of Contents (17 chapters)
JavaScript at Scale
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Router configuration


The mapping of our routes to their events is often lager than the router implementation itself. That's because as our application grows and acquires more route patterns, the list of possibilities gets bigger. A lot of the time, this is an unavoidable consequence of an application that's meeting its scaling demands. The trick is to not let a large number of route declarations collapse under their own weight, and this can happen in a number of ways.

There's more than one approach to configuring the routes that a given router instance responds to. Depending on the framework we're using, the router component may have more flexibility in how they're configured than others. Generally speaking, there's the static route approach, or the event registration approach. We'll also want to consider the router's ability to disable a given route at any given time.

Static route declarations

Simple applications usually configure their routers with a static declaration. This usually means...