babelouest / ulfius

Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services
https://babelouest.github.io/ulfius
GNU Lesser General Public License v2.1
1.07k stars 183 forks source link

HTTP GET with array as response body #250

Closed dancesWithCycles closed 1 year ago

dancesWithCycles commented 1 year ago

Hi folks, Thank you so much for maintaining this repository.

I am wondering what is the effort to transfer a REST API route like this to libulfius.

I have not used arrays as response bodies of HTTP GET methods with libulfius yet. Do you know any existing examples?

Cheers!

babelouest commented 1 year ago

Hello,

You should check the documentation, there is a paragraph about JSON integration using Jansson, this may help you.

You also have the sheep counter example program as a small example.

dancesWithCycles commented 1 year ago

Cheers @babelouest for the helpful advice!

For documentation reasons I created another example using a JSON array as response body in ulfius in this repository.