Getting the route that leads to action

12 views
Skip to first unread message

Paul Tiseo

unread,
Apr 26, 2016, 1:01:15 PM4/26/16
to actionHero.js
Inside an action, is there a way to get the matched route path?

For example, let's say I have a route like:
{ path: '/inventory/:siteId', action: 'getInventory' }

And, I send:
http://localhost:8080/api/inventory/['afd699d4-09c4-11e6-b5d8-b7e8d4aa1fb8','afd6dc96-09c4-11e6-b5d8-57d1907c9d0b']

The best I could find is data.connection.rawConnection.parsedURL.pathname which gives me back the above URL from /api... onward, but I want the generic form in the route. Is this in data somewhere?

Evan Tahler

unread,
Apr 26, 2016, 1:05:19 PM4/26/16
to actionHero.js
To clarify, do you want to find "/inventory/:siteId" or are you looking for the whole URL: http://localhost...?

Paul Tiseo

unread,
Apr 26, 2016, 1:18:03 PM4/26/16
to actionHero.js
The former. I want to get the pattern matched, not the actual, whole URL the user sent the server.

(I am basing role-based access on allowing a user on an API endpoint, as defined by the endpoint patterns.)

Evan Tahler

unread,
Apr 26, 2016, 6:18:35 PM4/26/16
to actionHero.js

Paul Tiseo

unread,
Apr 28, 2016, 9:42:18 PM4/28/16
to actionHero.js
Yes. So, when's the next release? (Don't want to get esoteric in my package.json. :) )

Evan Tahler

unread,
Apr 30, 2016, 4:03:16 PM4/30/16
to actionHero.js
right now!

Paul Tiseo

unread,
Apr 30, 2016, 10:50:29 PM4/30/16
to actionHero.js
Thank you. Appreciate it as I can now finish my audit preprocessor.
Reply all
Reply to author
Forward
0 new messages