当前位置: 软件>C/C++软件
C语言的Web框架 Raphters
本文导语: Raphters 是一个C 语言的Web框架,基于 RAPHT 架构模式。包含如下模块: Resources include things served up to clients like a database or API. Actions provide ways to interact with a Resource. Processors transform data. Handlers provide the entry point for a req...
Raphters 是一个C 语言的Web框架,基于 RAPHT 架构模式。包含如下模块:
- Resources include things served up to clients like a database or API.
- Actions provide ways to interact with a Resource.
- Processors transform data.
- Handlers provide the entry point for a request.
- Templates render data.
示例代码:
#include "raphters.h" START_HANDLER (simple, GET, "simple", res, 0, matches) { response_add_header(res, "content-type", "text/html"); response_write(res, "hello world"); } END_HANDLER START_HANDLER (default_handler, GET, "", res, 0, matches) { response_add_header(res, "content-type", "text/html"); response_write(res, "default page"); } END_HANDLER int main() { add_handler(simple); add_handler(default_handler); serve_forever(); return 0; }