B4J Library Cuppify - build Modern REST API's with ease

Discussion in 'B4J Libraries & Classes' started by FrostCodes, Dec 30, 2018.

  1. FrostCodes

    FrostCodes Member Licensed User

    A Professional B4J framework that allows you to build Modern REST API's with ease.

    You can download: HERE
    You can download JsonGenerator2 from here

    It is with the source code. You can upload your fixes or extra extensions to it and share and it would would merged if useful to the official library. :)

    The library is well commented and self-explanatory. Also a real life working sample is included with a sample client.


    Changelog:

    0.793
    • Added TSV and CSV generators to CuppifyUtils
    • Added JSONP generator to CuppifyUtils
    • Added support for Http Header versioning using Accept header
    • Added Header Method Overriding
    0.792
    • Added support for controller's methods (user_get, index_post...)
    • Added error handling when the method/controller could not be found
    • Added Custom Route feature
    • Added Custom Route feature with Regex Support
    • Added Fallback Route feature
    • Added Form Method Spoofing
    • Added Api versioning feature
    • Added support for Default Fallback Api Version
    • Added support for Http Header, Alias and Url versioning
    • Added Forcing the use of HTTPS For REST API calls feature
    • Added HTTP Status Codes List
    • Added wildcard CORS support
    • Added Force Ajax Only Feature

    :D Enjoy!
     
    Last edited: Jan 2, 2019
  2. Mashiane

    Mashiane Expert Licensed User

    Your code here... on the Users class is making a very risky assumption..

    Code:
    Dim datas As List = DBUtils.ExecuteMemoryTable( Main.SQL,"SELECT * FROM users Limit " & LimitStr, Null0)
        
         
    Dim resp As List
         resp.Initialize
        
        
    For Each data() As String() In datas
            
            
    Dim CurrentData, CurrentDataItems As Map
             CurrentData.Initialize
            CurrentDataItems.Initialize
            
            
            CurrentDataItems.Put(
    "name", data(1))
            CurrentDataItems.Put(
    "gender", data(2))
            CurrentDataItems.Put(
    "email", data(3))
            CurrentDataItems.Put(
    "company", data(4))
            CurrentDataItems.Put(
    "home_address", data(5))
            CurrentDataItems.Put(
    "ip_address", data(6))
            CurrentDataItems.Put(
    "occupation", data(7))
            
            CurrentData.Put(data(
    0), CurrentDataItems)
            resp.Add(CurrentData)
            
        
    Next
    That the sequencing of the columns from the users table will always follow this sequence. What if someone changes a field name or changes the sequences. Perhaps in your select include the field names to ensure they are in that order. #MyTwoCents
     
    jimmyF likes this.
  3. Mashiane

    Mashiane Expert Licensed User

    CuppyfyUtils needs JSONGenerator2, please advise..
     
  4. FrostCodes

    FrostCodes Member Licensed User


    Yes , thanks for noticing that. In a real life app you are to build the way you want and prefer. The above code is just a quick sample on how cuppify works.
     
    Mashiane likes this.
  5. FrostCodes

    FrostCodes Member Licensed User

    Hi, kindly look at the link in post #1, i added what you requested
     
    Mashiane likes this.
  6. hibrid0

    hibrid0 Active Member Licensed User

    Thanks a lot for your share!
     
  7. FrostCodes

    FrostCodes Member Licensed User

    Welcome :)
     
  8. Diceman

    Diceman Active Member Licensed User

    Your code reference "CFStringUtility", "cfdatatypeutility", "cfdatageneratorutility". Do you have a link where I can find them?
    I already have json-simple, jsonplus in my B4J\AdditionalLibraries.

    TIA
     
  9. FrostCodes

    FrostCodes Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice