When a URL file request is made I check the file name.  For example if the
file name is stats.json then I know the client is requesting my status.  So
at that point I create the status json contents in RAM memory and then have
the http server serve up that string.   Care needs to be taken for example
if two clients make requests for the stats.json it can be a problem with
one RAM buffer.  Specifically I have to be sure the first one is finished
using the buffer before I use it again for the second client.  Therefore
the second client gets an error until the first one is done with the
buffer.


Trampas



On Mon, Feb 1, 2021 at 11:49 AM Marco Giammarini <m.giammar...@gmail.com>
wrote:

> Dear all,
> I am using lwIP over K64 (NXP microcontroller) and I would add REST API to
> my project.
> I try to understand how to do that, and the only way that I have found is
> to use CGI. The problem is the reply: I can reply only with a static file
> present in the SDCARD (the return of the callback function tCGIHandler is
> the address of the file).
>
> Does someone implemented REST API with LwIP?
> Does someone return a JSON build at runtime?
> Does someone parse a GET REST request build with / and not with &? How?  I
> mean api/test/1/3 instead of api/test.cgi?arg=1&subarg=3
>
>
> Thanks
> Marco
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to