# Creating a route in a plugin

**URL:** <https://meta.discourse.org/t/creating-a-route-in-a-plugin/38407>\
**Category:** Support\
**Created:** [2016 年 1 月 24 日午後 8:52 UTC](https://meta.discourse.org/t/creating-a-route-in-a-plugin/38407 "2016-01-24T20:52:56Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![arrancscott](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arrancscott/32/50191_2.png) [@arrancscott](https://meta.discourse.org/u/arrancscott)\
**Post date:** [2016 年 1 月 24 日午後 8:52 UTC](https://meta.discourse.org/t/creating-a-route-in-a-plugin/38407/1 "2016-01-24T20:52:56Z")

</div>

Hey guys,

I need a bit of help from someone familiar with creating routes in plugins.

I’ve created a plugin and have a route specified in my plugin.rb file like so:

```
register_asset 'javascripts/discourse/templates/user/route.hbs'

after_initialize do
 Discourse::Application.routes.append do
   get 'users/:username/route' => 'users#show', constraints: {username: USERNAME_ROUTE_FORMAT}
 end
end

```

I also have a ‘\*-route-map.js.es6’ file which declares this route like so:

```
export default function() {
   this.resource('user', function() {
   this.route('route', {path: 'route'});
 });
}`

```

I literally want to create a route like ‘/users/:username/route’ but none of what I’m doing seems to be working and I’m getting the default 404 page when I go to that URL.

I’ve looked at how a few plugins do it such as the tagging one and I seem to be doing everything correctly so I can’t figure out where I’m going wrong. Can someone help please?

---

_[View the full topic](https://meta.discourse.org/t/creating-a-route-in-a-plugin/38407)._
