marcoschwartz / aREST

A RESTful environment for Arduino
http://aREST.io/
Other
1.2k stars 279 forks source link

Registered functions return String instead of int #279

Open areyalp opened 4 years ago

areyalp commented 4 years ago

Now registered function methods in the code return String instead of int. For instance, it would allow the responses to be more complex, now it can be returned a response containing String, int casted to String or even a JSON or XML. Therefore, it lets you reply with more than one simple integer.

E.g:

void setup() { . . . rest.function("test", testFunction); }

String testFunction(String params) { String strJson= "{\"key1\" : \"value1\", \"key2\" : \"value2\"}"; return strJson; }

I did a test with the following result:

image