delvedor/find-my-way

async deriveConstraint support

climba03003 opened this issue · 1 comments

I have through about it a long time ago and tried hard to prevent this usage in my application.

The use-case I have is derive the route based on JWT token.
I contain all the required permission, so the router can reach their dedicated handler based on JWT token.

In a relative small scale project, it works absolutely fine and I am happy with the result.
But somehow when the project growth and JWT token will extended to a very long string.
It will exceed the limit of header from node, reverse proxy, etc. and increasing the header limit endlessly is not a good solution.

Somehow, I need to fetch the permission inside database to prevent the extend of JWT size.

The async request here is not about async-await.
But the resolve of constraint value can be done in async way, only support callback usage based on performance reason is absolutely fine.