Defining route groups within packages?


#1

I’m very much favoring the “package-only” approach to developing apps, where all core functionality is added to smaller packages.

What I am wondering is – can I create routes within my packages? Here is what an individual package looks like

Auth (package for authentication handling)
├── README.md
├── client
│   └── forms.js
├── package.js
├── routes.js
├── server
│   ├── methods.js
│   ├── publications.js
│   └── seed.js
└── tests
    ├── login.js
    └── models.js

I define my routes like this:

AuthRoutes = FlowRouter.group({
  prefix: '/auth'
});

AuthRoutes.route('/login', {
  action: function () {
    BlazeLayout.render('Layout', {
      content: 'LoginForm'
    });
  }
});

And then I export AuthRoutes. It seems to be added to the router, but it never renders my templates as intended.