Using existing router in an auxiliary package


Say one wanted to write a package which exposed its functionality on a specific, possibly configurable, route – such as a control panel or style guide.

What would be a good pattern for using the app’s existing router, instead of adding your own?

Presumably, the package would check whether, for instance, IronRouter or FlowRouter has already been added to the project, and then register the route there – or add its own router of choice if nothing was found.

Something tells me I’ve seen some packages do this – could you point me towards one that I could use as inspiration?