Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    Having private libs/utils

    Cloud Backend (Cloud DB, API Builder)
    2
    3
    292
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Pierre SULPICE
      Pierre SULPICE last edited by

      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,

      1 Reply Last reply Reply Quote 0
      • Wassim
        Wassim last edited by

        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.

        Pierre SULPICE 1 Reply Last reply Reply Quote 0
        • Pierre SULPICE
          Pierre SULPICE @Wassim last edited by

          @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,

          1 Reply Last reply Reply Quote 3
          • First post
            Last post