当前位置

网站首页> 程序设计 > 开源项目 > 编程语言 > 浏览文章

C++14 的 Web 框架 Silicon

作者:小梦 来源: 网络 时间: 2024-05-20 阅读:

阿里百川梦想创业大赛,500万创投寻找最赞的APP

Silicon 是一个高性能的面向中间件的 C++14 HTTP Web 开发框架,为 C++ 带来类似其他动态语言 Web 框架的便利性。

一个简单的输出 Hello world 的 JSON 接口:

#include <silicon/api.hh>#include <silicon/mhd_serve.hh>using namespace sl;// Define the API:auto hello_api = make_api(  // The hello world procedure.  @hello = [] () { return D(@message = "Hello world."); });int main(){  // Serve hello_api via microhttpd using the json format:  sl::mhd_json_serve(hello_api, 12345);}

相关阅读