Raphters是一个C语言的Web框架,基于RAPHT架构模式。包含如下模块:
ResourcesincludethingsserveduptoclientslikeadatabaseorAPI.ActionsprovidewaystointeractwithaResource.Processorstransformdata.Handlersprovidetheentrypointforarequest.Templatesrenderdata.示例代码:
#include"raphters.h"START_HANDLER(simple,GET,"simple",res,0,matches){response_add_header(res,"content-type","text/html");response_write(res,"helloworld");}END_HANDLERSTART_HANDLER(default_handler,GET,"",res,0,matches){response_add_header(res,"content-type","text/html");response_write(res,"defaultpage");}END_HANDLERintmain(){add_handler(simple);add_handler(default_handler);serve_forever();return0;}
评论