send_json()
send_json()
is for sending application/json
responses easily. It runs reply() function under the hood.
static inline void send_json(Res *res, int status, const char *body){ reply(res, status, "application/json", body, strlen(body));}
Example usage:
#include "ecewo.h"
void hello_world(Req *req, Res *res){ send_json(res, 200, "{ \"message\": \"hello world!\" }");}