First of all, I'm not claiming that my framework will save industrial C/C++ development. It's just a hobby project.Industrial code needs safer code, not easier code. But when you're developing a blog at 8 PM, long template errors are annoying.You need CRUD and RDBMS. It's simple.CWIST is for that kind of work.It sacrifices memory safety, smart pointers, and modern C++ abstractions. In return, compile errors are more predictable. #include
#include
#include
#include
static cwist_db_pool_t *g_db_pool;
static void send_error(cwist_http_response *res, const char *msg) {
res->status_code = CWIST_HTTP_INTERNAL_ERROR;
cwist_http_header_add(&res->headers, "Content-Type", "text/plain");
cwist_sstring_assign(res->body, msg);
}
static void render(cwist_http_response *res, const char *path, cJSON *ctx) {
cwist_sstring *html = cwist_template_render_file(path, ctx);
if (html) {
cwist_http_header_add(&res->headers, "Content-Type", "text/html");
cwist_sstring_assign(res->body, html->data);
cwist_sstring_destroy(html);
}
cJSON_Delete(ctx);
}
Discussion (0)
No comments yet. Start the conversation!