Luja Shrestha
Luja Shrestha

Reputation: 2847

Absolute path in sails

There are two different controllers which have to invoke the Y action inside controller X. But the route varies according to the controller it is called from.

When Y called from controller A its route becomes A/X/Y
When Y called from controller B its route becomes B/X/Y How can we make the route always be X/Y irrespective of the calling controller?

Upvotes: 0

Views: 204

Answers (1)

danba
danba

Reputation: 877

Perhaps the problem is ill posed.

You can extract the functionality from the action Y of Controller X to a policy and call it from all controllers that require it.

If you're familiar with express, every policy is an express middleware.

Upvotes: 1

Related Questions