Skip to content

Commit

Permalink
File streaming example.
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-42 committed Jan 28, 2017
1 parent dc301c7 commit be56a52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/CMakeLists.txt
Expand Up @@ -40,6 +40,9 @@ target_link_libraries(ws_broadcast_server ${WEBSOCKETS_LIBS})
add_executable(https https.cc)
target_link_libraries(https ${MHD_LIBS})

add_executable(file_streaming file_streaming.cc)
target_link_libraries(file_streaming ${MHD_LIBS})

add_executable(access_http_header_with_mhd access_http_header_with_mhd.cc)
target_link_libraries(access_http_header_with_mhd ${MHD_LIBS})

17 changes: 17 additions & 0 deletions examples/file_streaming.cc
@@ -0,0 +1,17 @@
#include <iostream>
#include <silicon/backends/mhd.hh>
#include <silicon/api.hh>
#include <silicon/clients/libcurl_client.hh>
#include "symbols.hh"

using namespace s;

using namespace sl;

auto hello_api = http_api
(GET / _text = [] () { return file("./my_file.txt"); });

int main(int argc, char* argv[])
{
auto ctx = sl::mhd_json_serve(hello_api, 12345);
}

0 comments on commit be56a52

Please sign in to comment.