這是一個基於FastCGI和C++的基於HTTP的Resuful API開發框架。其依賴於fastcgi庫,boost庫,libmysqlpp,libredisclient,jsoncpp,其中用了C++11的特性。前端
前端web服務器咱們使用Nginx,須要的配置以下: mysql
location ~* ^/ccfast/.+\.do$ { fastcgi_pass 127.0.0.1:10000; include fastcgi.conf; }
ccfast 和main.cpp中的 set_project
的值同樣,以下:nginx
UrlRoute* _p = UrlRoute::instance(); _p->set_project("/ccfast");
在 urlfunction.h 添加一個url對應的function,在 urlfunction.cpp 中實現,在 main.cpp 中註冊這個url和方法。以下:git
_p->register_url("/love.do", love);
啓動nginx,在瀏覽器中,輸入http://localhost/ccfast/love.do?boy=zhou&girl=chen
,結果以下圖:
web
基於這個框架,咱們能夠快速的開發效率很高的API服務。詳細請看 love 的例子。
請設置好你本身的 mysql_redis.conf
,否則不能正確運行。redis
使用ccfast_install進行安裝,咱們使用 * spawn-fcgi* 來進行fcgi進程的啓動,命令以下:spawn-fcgi -a 127.0.0.1 -p 10000 -f /usr/local/ccfast/ccfast
sql
oschina git:https://git.oschina.net/zhouX/ccfast.gitjson