send_html()
send_html()
is for sending text/html
responses easily. It runs reply() function under the hood.
static inline void send_html(Res *res, int status, const char *body){ reply(res, status, "text/html", body, strlen(body));}
Example usage:
#include "ecewo.h"
void hello_world(Req *req, Res *res){ const char *html = "<!DOCTYPE html>" "<html lang=\"en\">" "<head><meta charset=\"UTF-8\"><title>Hello</title></head>" "<body><h1>Hello, world!</h1></body>" "</html>";
send_html(res, 200, html);}