Hi there, I just found this article by searching for this exact functionality. In my case I want to share my entire permission/authorization module onto the front end.
I have several elements on some pages which are shown or not shown depending on some complex if statements - which are written into my service layer (ASP.NET). At the moment I am calling these back end functions from JS - so they are being reused which is great, but each call costs 200-500 ms. They do all load in parallel which is nice, but I can see this becoming a huge problem if I decided to make table view of many many rows of data all with their own "management" buttons.
So at the moment this is making me thing that I want the exact same code which makes decisions about if a user is allowed to do a particular action on a particular entity - on the front end too. It would allow me to pass the users session, and the relevant object/entity into a function, and return a simple true or false. Exactly as I do now, but without having to travel over the network.
This may make me move from ASP to Node...