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

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 be 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:

Mashiane

Expert
Licensed User
Longtime User
Your code here... on the Users class is making a very risky assumption..

B4X:
Dim datas As List = DBUtils.ExecuteMemoryTable( Main.SQL,"SELECT * FROM users Limit " & LimitStr, Null, 0)
    
     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
 

FrostCodes

Active Member
Licensed User
Longtime User
Your code here... on the Users class is making a very risky assumption..

B4X:
Dim datas As List = DBUtils.ExecuteMemoryTable( Main.SQL,"SELECT * FROM users Limit " & LimitStr, Null, 0)
   
     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


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.
 

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
 

luke2012

Well-Known Member
Licensed User
Longtime 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!

Outstanding thing :) Is there any tutorial / sample about it ?
 

FrostCodes

Active Member
Licensed User
Longtime User
Outstanding thing :) Is there any tutorial / sample about it ?


yes please download client zip and server zip.
the clients showcases a sample client or how to interact with the APIs
the server is the code sample and the modules needed to run the server fully, it come with many samples.
 
Top