REMINDER
Having private libs/utils
-
Hello,
I think I remember that it's not something possible, but I want to be sure :Is there any way to have private code/libs/utils callable from the API routes ?
Basic exemple why :
Let's say I want to check always the same thing, in 50 roads, like the origin and the credentials of this origin to use a given endpoint. Right now I have three options :- Public code in the CloudBackend folder through the Code Editor that I require-remote (so it's public)
- Putting that code in all my routes... which is a bother if I want to change it
- Having a "proxy" route that will do this check first and call the road itself, which is one "useless" API call (and other little issues)
Thank you,
Best regards, -
Hello,
With the require-remote solution the file is public but can be impossible to find if put in a very complex path.
Another solution would be not to use the online code editor from a Cloud API Function but build yours outside and import the ZIP into your API function. This way you have more options to reuse private code. -
@Wassim thanks for you answer.
I agree that the file will be tricky to find but I still try to the basic "even hard to find it shouldn't be public when it's related to security", and it's literally for all ma security checks
I thought about the other solution but I'm trying to develop something very easy to maintain for any developers even with a low formation for my clients, your solution itself is great and easy to use, I don't want to complexify it.
I think the third solution I will retain is to create a proxy route that will take care of this common code then call the adequate resource and return the result.
I think having private code outside of a route but still on AppDrag is the only major feature I miss right now !
I haven't said it in a while: Thanks for AppDrag in general, I'm really having a great time on it
See you soon,
Best regards,