Search code examples
mongodbmeteoriron-router

Meteor's Houston:admin not working with Iron:router


I'm using iron:router to define paths in my Meteor application.

Now, I want to use houston:admin package to have a Django-like admin interface for Meteor's Mongodb.

The issue is that:

  • if I use houston's admin without adding iron's router, it works flawlessly by simply navigating to localhost:3000/admin
  • if I use houston's admin after adding iron's router, when I (manually) navigate to localhost:3000/admin, it redirect me to the default route (/config) I set client-side.

Routing rules are defined in shared/lib/routing.js.

Default route is defined client-side in client/app.js as:

 Router.go('config');

Solution

  • A solution is to only enforce the default route if the current path does not begin with /admin

    in client/app.js

    if(!Iron.Location.get().path.match(/^\/admin/)){
      Router.go('config');
    }