Multiple routes in one plugin


#1

I’ve managed to add a route in /user/:username/music by writing my music-route-map.js.es6 file as:

export default {
  resource: 'user',
  path: 'users/:username',
  map() {
    this.resource('music', { path: '/music' });

  }
}

Now I want to add another route but in the root as /music. Can this be done in my route-map file.

Thanx


User page with custom data from external DB
(Arran Scott) #2

I asked a similar question to this but after a day of scratching my head and no replies I found this post which answered my question and helped me figure out what I was doing wrong, so in return I’ll try to help you as much as I can (I’ve only been using it for a week or so, just to let you know).

I think you could do something similar to what is written on part 5 of the Discourse plugins tutorial.

export default {
  resource: '/music',
  path: '/music',
  map() {
   this.route('music');
 }
};

Give that a whirl and see if that works?