# How i integrate routes from addon

**URL:** <https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563>\
**Category:** Routing\
**Created:** [February 26, 2020, 10:03pm UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563 "2020-02-26T22:03:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timbuktu82](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@Timbuktu82](https://discuss.emberjs.com/u/Timbuktu82)\
**Post date:** [February 26, 2020, 10:03pm UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/1 "2020-02-26T22:03:07Z")

</div>

Hi, i write an addon und generate routes/templates inside this addon. But the routes does not accessable. How can i inject these addon-routes into router.js or respectively make this routes accessable? thx

---

<div class="post-metadata">

**Author:** ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)\
**Post date:** [February 26, 2020, 10:26pm UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/2 "2020-02-26T22:26:12Z")

</div>

You can define routes in an addon and they will be merged into the app’s namespace (if they are properly re-exported) however they aren’t added to the route map unless you either:

1. add them to the app’s route map as usual
2. do it in the addon in an instance-initializer (pretty sure this works) so any app that uses the addon will automatically add the addon routes to the route map

Alternatively you could use a routable engine, which is really kind of the answer to “an addon that has routes”

---

<div class="post-metadata">

**Author:** ![Timbuktu82](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@Timbuktu82](https://discuss.emberjs.com/u/Timbuktu82)\
**Post date:** [February 27, 2020, 7:08am UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/3 "2020-02-27T07:08:16Z")

</div>

Hey dknutsen,

thank you for your help. All this ways i have done in the past and it always worked, but only not in this case.

Now I just had an epiphany. I have do a great mistake. In use of all this ways i become the message “too many recursions” from browser console. The great mistake is that i use the same name for main project an for the used addon. In this case i build a special addon for a customer project. I gave the addon a new name and it works fine now.

Thank you for your fast help

---

<div class="post-metadata">

**Author:** ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)\
**Post date:** [February 27, 2020, 3:14pm UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/4 "2020-02-27T15:14:12Z")

</div>

Awesome glad you got it working!

---

<div class="post-metadata">

**Author:** ![VYSHNAV\_RAJ\_S](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/vyshnav_raj_s/32/17041_2.png) [@VYSHNAV\_RAJ\_S](https://discuss.emberjs.com/u/VYSHNAV_RAJ_S)\
**Post date:** [October 12, 2020, 11:58am UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/5 "2020-10-12T11:58:02Z")

</div>

@dknutsen Can you show a demo on how to do that within the addon using instance-initializer, please?

---

<div class="post-metadata">

**Author:** ![VYSHNAV\_RAJ\_S](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/vyshnav_raj_s/32/17041_2.png) [@VYSHNAV\_RAJ\_S](https://discuss.emberjs.com/u/VYSHNAV_RAJ_S)\
**Post date:** [October 12, 2020, 12:07pm UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/6 "2020-10-12T12:07:53Z")

</div>

![Screenshot from 2020-10-12 17-33-40](https://us1.discourse-cdn.com/flex019/uploads/emberjs_public/original/3X/b/3/b30a3cbc2712b37fe978d945b4e4c1ee02772ba8.png)

Suppose if I included the route using instance-initializer of the main application, then do I have to include for each and every route in the addon. That is if there are 5 different routes in the addon then I have to include all 5 routes in my instance-initializer of the main application.

---

<div class="post-metadata">

**Author:** ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)\
**Post date:** [October 12, 2020, 2:39pm UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/7 "2020-10-12T14:39:15Z")

</div>

Yes I think you would. Addons should be explicit about what they’re adding in to the parent app.

---

<div class="post-metadata">

**Author:** ![udhay\_hari](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/udhay_hari/32/18165_2.png) [@udhay\_hari](https://discuss.emberjs.com/u/udhay_hari)\
**Post date:** [September 16, 2023, 7:54am UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/8 "2023-09-16T07:54:46Z")

</div>

Hi @dknutsen, I have an inapp addon which is dependent on the main application. Is there a possibility to run the tests within the addon in isolation using the main application’s testem config and fixtures. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)\
**Post date:** [September 18, 2023, 2:34pm UTC](https://discuss.emberjs.com/t/how-i-integrate-routes-from-addon/17563/9 "2023-09-18T14:34:51Z")

</div>

Hi @udhay_hari, could you be more specific about what you mean? If all you want is to run the addon test suite with the app testem and fixtures (I’ve never attempted something like that but…) there’s probably a way you could import some/all of that in order to reuse it.

I was under the impression that in-repo addons (if that’s what you mean by in-app addon) could not have their own tests and that the tests MUST exist in the parent context. Secondly I’d strongly consider migrating away from in-repo addons as I don’t think they’ll be supported in the future. The “modern” equivalent would probably be a monorepo with a separate “real” addon.
