Index route in pod structure


#1

Where should one place application’s index route in pod structure?


#2

Make an index/ folder at the root of your pod structure, the same level that application/ is at.


#3

In general, you can discover where files go by running the related generate command. In this case, ember g route index


#4

Hi :slight_smile: Thanks for the reply. When i ran the command, I got like this - "create app/routes/index.js create app/templates/index.hbs ". However, this is not in POD structure. I need to place my index route. And having it under index/ folder doesn’t seem to work.


#5

try ember g route index --pod

your folder in app/index should work though. You can uncomment ENV.APP.LOG_RESOLVER in environment/config. That line will log whatever Ember tries to “find” to the browser’s console


#6

Right, the generate command will tell you where the files go under your current configuration. You’ll want to first configure it to use pods structure (so that you don’t have to manually change the location of every file following each generate command). To do so, edit .ember-cli to include the following:

{
  "usePods": true
}

#7

The generator seems to generate it in app/index/ but the resolver does not find it there. Strange… Ember CLI version: 0.2.7


#8

Oh I found out why it is because my url for the foo route was {path: '/'} .

What I wanted to do is to have the same menu for all /foo /bar /baz routes and for all routes deeper like: /foo/id /bar/foo/id baz/id leave the menu out. But I think that does not work with an index template anyways.


#9

I want an index route for the overall application. Having it under index/ folder is not working. Any idea where to place it?


#10

You have to place it in the app/pods/application folder I think.