a c fastcgi framework

來源:互聯網
上載者:User

標籤:fastcgi   開發   庫   c   

ccfast

這是一個基於FastCGI和C++的基於HTTP的Resuful API開發架構。其依賴於fastcgi庫,boost庫,libmysql++,libredis,其中用了C++11的特性。

前端web伺服器我們使用Nginx,需要的配置如下:

   location ~* ^/ccfast/.+\.do$ {           fastcgi_pass    127.0.0.1:10000;           include         fastcgi.conf;        }

ccfast 和main.cpp中的 set_project的值一樣,如下:

        UrlRoute* _p = UrlRoute::instance();        _p->set_project("/ccfast");

urlfunction.h 添加一個url對應的function,在 urlfunction.cpp 中實現,在 main.cpp 中註冊這個url和方法。如下:

        _p->register_url("/love.do", love);

啟動nginx,在瀏覽器中,輸入http://localhost/ccfast/love.do?boy=zhou&girl=chen,結果如:



基於這個架構,我們可以快速的開發效率很高的API服務。詳細請看 love 的例子。
請設定好你自己的mysql_redis.conf,不然不能正確運行。

INSTALL

使用ccfast_install進行安裝,我們使用 * spawn-fcgi* 來進行fcgi進程的啟動,命令如下:spawn-fcgi -a 127.0.0.1 -p 10000 -f /usr/local/ccfast/ccfast

詳情見項目地址:https://github.com/ZhouBox/ccfast.git

a c fastcgi framework

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.