A high performance, middleware oriented C++14 http web framework please use matt-42/lithium instead

Overview

This project has been rewritten and moved inside the Lithium libraries:

https://github.com/matt-42/lithium/tree/master/libraries/http_backend

The Silicon Web Framework

Documentation is hosted on http://siliconframework.org

Contributing

Contributions are welcome. Silicon can be easily extended with

  • New middlewares
  • New backends (websockets, other non-http protocols)
  • New message formats (messagepack, protobuf, ...)

Do not hesitate to fill issues, send pull requests, or contact me at [email protected].

Donate

If you find this project helpful, please consider donating.

Click here to lend your support to: The Silicon Web Framework and make a donation at pledgie.com !
Issues
  • handle missing paths

    handle missing paths

    There are a number of things I'd like to do:

    1. If a path is not defined

      • Try to serve a static file from some configured directory
      • If no static file exists at the path, produce custom JSON HTTP 404 (but I guess more generally provide custom HTTP errors when API functions aren't called)

      The intent is to serve an AngularJS app and it seems avoidable to run nginx etc when silicon should be capable of throwing some HTML/JS/CSS files back at a browser. From reading the docs, I got the impression that using a middleware is the way to go but couldn't see how the path interception would happen, seems all middleware are created before a request and destroyed when it's completed but if a path doesn't match a middleware wouldn't be called right?

    2. I want to drop in wangle as a backend, is there a ref of things to do, not to do.

    On both 1 and 2, I've had a quick browse of the code for mhd and it seems whether it's possible depends on the functionality of the backend, https://github.com/matt-42/silicon/blob/master/silicon/backends/mhd.hh#L363 for example appears to just do a hand off to microhttpd, is that right or have I missed something?

    opened by zcourts 22
  • Install script fails on OS X Yosemite 10.10.1

    Install script fails on OS X Yosemite 10.10.1

    Hi, I just wanted to install silicon but I got the following error:

    CMake Error at /usr/local/Cellar/cmake/3.1.0/share/cmake/Modules/CMakePackageConfigHelpers.cmake:254 (file): file RELATIVE_PATH must be passed a full path to the file: Call Stack (most recent call first): CMakeLists.txt:17 (configure_package_config_file)

    The log file CMakeOutput.log does not seem to include useful information.

    OS: OS X Yosemite 10.10.1

    clang: Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.0.0 Thread model: posix

    cmake: cmake version 3.1.0 CMake suite maintained and supported by Kitware (kitware.com/cmake).

    opened by lhigueragamboa 8
  • optional parameters in request?

    optional parameters in request?

    from https://github.com/matt-42/iod, it seems we can use named optional function arguments to do it, but could you please give a simple example on the right syntax?

    opened by byzhang 6
  • How to accept `std::vector<int>` as get or post parameter

    How to accept `std::vector` as get or post parameter

    I'd like to write a code like this:

    PUT / _region * post_parameters(_id = int(),
                                                            _x = int(),
                                                            _y = int(),
                                                            _width = int(),
                                                            _height = int(),
                                                            _comment = std::string(),
                                                            _type = std::string(),
                                                            _near = std::vector<int>()) = [] (auto p) {
                                                       return regionController.put(p.id,
                                                                                   p.x,
                                                                                   p.y,
                                                                                   p.width,
                                                                                   p.height,
                                                                                   p.comment,
                                                                                   p.type,
                                                                                   p.near);
                                                   }
    

    but I receive a static_assert with

    "Target type is neither std::istream`able nor std::wistream`able" 
    

    text

    opened by fnc12 5
  • websocket example on your website does not compile with g++

    websocket example on your website does not compile with g++

    Here is the console output: 09:55:21 **** Incremental Build of configuration Debug for project SiliconTest **** make pre-build main-build iod_generate_symbols ../main.cpp ../symbols.h

    Building file: ../main.cpp Invoking: Cross G++ Compiler g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.o" -o "main.o" "../main.cpp" In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh: In instantiation of ‘auto sl::make_ws_route(const E&) [with E = iod::function_call_exp<s::_message_t, s::_text_t>]’: /usr/include/silicon/remote_api.hh:40:41: required from ‘auto sl::make_ws_remote_api(P ...) [with P = {iod::function_call_exp<s::_message_t, s::_text_t>}]’ /usr/include/silicon/backends/websocketpp_remote_client.hh:106:34: required from ‘auto sl::make_wspp_remote_client(const P& ...) [with P = {iod::function_call_exp<s::_message_t, s::_text_t>}]’ ../main.cpp:100:59: required from here /usr/include/silicon/backends/ws_api.hh:144:21: error: no matching function for call to ‘route_cat(sl::ws_route<>, const iod::function_call_exp<s::_message_t, s::_text_t>&)’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/silicon/api.hh:12:0, from ../main.cpp:39: /usr/include/silicon/http_route.hh:284:8: note: candidate: template<class ... R1, class ... R2> auto sl::route_cat(const sl::http_route<R1 ...>&, const sl::http_route<R2 ...>&) auto route_cat(const http_route<R1...>& r1, ^~~~~~~~~ /usr/include/silicon/http_route.hh:284:8: note: template argument deduction/substitution failed: In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh:144:21: note: ‘sl::ws_route<>’ is not derived from ‘const sl::http_route<R1 ...>’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/silicon/api.hh:12:0, from ../main.cpp:39: /usr/include/silicon/http_route.hh:291:8: note: candidate: template<class ... R1, class R2> auto sl::route_cat(const sl::http_route<R1 ...>&, const R2&) auto route_cat(const http_route<R1...>& r1, ^~~~~~~~~ /usr/include/silicon/http_route.hh:291:8: note: template argument deduction/substitution failed: In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh:144:21: note: ‘sl::ws_route<>’ is not derived from ‘const sl::http_route<R1 ...>’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/silicon/api.hh:13:0, from ../main.cpp:39: /usr/include/silicon/rmq_route.hh:164:7: note: candidate: template<class ... R1, class ... R2> auto sl::route_cat(const sl::rmq::route<R1 ...>&, const sl::rmq::route<R2 ...>&) auto route_cat(rmq::route<R1...> const & r1, ^~~~~~~~~ /usr/include/silicon/rmq_route.hh:164:7: note: template argument deduction/substitution failed: In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh:144:21: note: ‘sl::ws_route<>’ is not derived from ‘const sl::rmq::route<R1 ...>’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/silicon/api.hh:13:0, from ../main.cpp:39: /usr/include/silicon/rmq_route.hh:171:7: note: candidate: template<class ... R1, class R2> auto sl::route_cat(const sl::rmq::route<R1 ...>&, const R2&) auto route_cat(rmq::route<R1...> const & r1, ^~~~~~~~~ /usr/include/silicon/rmq_route.hh:171:7: note: template argument deduction/substitution failed: In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh:144:21: note: ‘sl::ws_route<>’ is not derived from ‘const sl::rmq::route<R1 ...>’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:118:8: note: candidate: template<class S, class P, class SS> auto sl::route_cat(sl::ws_route<S, P>, const iod::symbol&) auto route_cat(ws_route<S, P> r, const iod::symbol& s) ^~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:118:8: note: template argument deduction/substitution failed: /usr/include/silicon/backends/ws_api.hh:144:21: note: ‘const iod::function_call_exp<s::_message_t, s::_text_t>’ is not derived from ‘const iod::symbol’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:124:8: note: candidate: template<class S, class P, class T> auto sl::route_cat(sl::ws_route<S, P>, const sl::params_t&) auto route_cat(ws_route<S, P> r, const params_t& s) ^~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:124:8: note: template argument deduction/substitution failed: /usr/include/silicon/backends/ws_api.hh:144:21: note: ‘const iod::function_call_exp<s::_message_t, s::_text_t>’ is not derived from ‘const sl::params_t’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:130:8: note: candidate: template<class S, class P, class L, class R> auto sl::route_cat(sl::ws_route<S, P>, const iod::div_exp<L, R>&) auto route_cat(ws_route<S, P> r, const iod::div_exp<L, R>& e) ^~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:130:8: note: template argument deduction/substitution failed: /usr/include/silicon/backends/ws_api.hh:144:21: note: ‘const iod::function_call_exp<s::_message_t, s::_text_t>’ is not derived from ‘const iod::div_exp<L, R>’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:136:8: note: candidate: template<class S, class P, class L, class R> auto sl::route_cat(sl::ws_route<S, P>, const iod::mult_exp<L, R>&) auto route_cat(ws_route<S, P> r, const iod::mult_exp<L, R>& e) ^~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:136:8: note: template argument deduction/substitution failed: /usr/include/silicon/backends/ws_api.hh:144:21: note: ‘const iod::function_call_exp<s::_message_t, s::_text_t>’ is not derived from ‘const iod::mult_exp<L, R>’ return route_cat(ws_route<>(), e); ~~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from ../main.cpp:40:0: /usr/include/silicon/remote_api.hh: In instantiation of ‘auto sl::make_ws_remote_api(P ...) [with P = {iod::function_call_exp<s::_message_t, s::_text_t>}]’: /usr/include/silicon/backends/websocketpp_remote_client.hh:106:34: required from ‘auto sl::make_wspp_remote_client(const P& ...) [with P = {iod::function_call_exp<s::_message_t, s::_text_t>}]’ ../main.cpp:100:59: required from here /usr/include/silicon/remote_api.hh:40:27: error: invalid use of void expression return std::make_tuple(make_ws_route(procs)...); ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/silicon/backends/websocketpp.hh:13:0, from ../main.cpp:41: /usr/include/silicon/backends/websocketpp_remote_client.hh: In instantiation of ‘auto sl::make_wspp_remote_client(const P& ...) [with P = {iod::function_call_exp<s::_message_t, s::_text_t>}]’: ../main.cpp:100:59: required from here /usr/include/silicon/backends/websocketpp_remote_client.hh:106:48: error: ‘void api’ has incomplete type auto api = make_ws_remote_api(procedures...); ^ /usr/include/silicon/backends/websocketpp_remote_client.hh:108:36: error: use of ‘auto iod::assignable::operator=(L&&) const [with L = std::shared_ptrsl::wspp_remote_client_ctx&; E = s::_silicon_ctx_t]’ before deduction of ‘auto’ auto accessor = D(_silicon_ctx = c); ~~~~~~~~~~~~~^~~ /usr/include/silicon/backends/websocketpp_remote_client.hh: In instantiation of ‘struct sl::make_wspp_remote_client(const P& ...) [with P = {iod::function_call_exp<s::_message_t, s::_text_t>}]::<lambda(struct sl::wspp_connection)>’: /usr/include/silicon/backends/websocketpp_remote_client.hh:116:5: required from ‘auto sl::make_wspp_remote_client(const P& ...) [with P = {iod::function_call_exp<s::_message_t, s::_text_t>}]’ ../main.cpp:100:59: required from here /usr/include/silicon/backends/websocketpp_remote_client.hh:111:13: error: using invalid field ‘sl::make_wspp_remote_client(const P& ...)::<lambda(sl::wspp_connection)>::’ return [rc] (wspp_connection c) { ^~ ../main.cpp: In function ‘int main(int, char**)’: ../main.cpp:100:59: error: ‘void rclient’ has incomplete type auto rclient = make_wspp_remote_client( _message(_text) ); ^ In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh: In instantiation of ‘sl::parse_api(std::tuple<_Args2 ...>, R)::<lambda(auto:65)>::<lambda(auto:67)> [with auto:67 = iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >; auto:65 = iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >; R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::message_t>, main(int, char**)::<lambda(auto:136)> >}]’: /usr/include/iod/utils.hh:24:19: required from ‘decltype(auto) iod::static_if::operator()(F, G, A&& ...) [with F = sl::parse_api(std::tuple<_Args2 ...>, R)::<lambda(auto:65)> [with auto:65 = iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >; R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:66)>; G = sl::parse_api(std::tuple<_Args2 ...>, R)::<lambda(auto:65)> [with auto:65 = iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >; R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:67)>; A = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >&}]’ /usr/include/iod/utils.hh:31:27: required from ‘decltype(auto) iod::static_if(F, G, A&& ...) [with bool C = false; F = sl::parse_api(std::tuple<_Args2 ...>, R)::<lambda(auto:65)> [with auto:65 = iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >; R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:66)>; G = sl::parse_api(std::tuple<_Args2 ...>, R)::<lambda(auto:65)> [with auto:65 = iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >; R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:67)>; A = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >&}]’ /usr/include/silicon/api.hh:210:59: required from ‘sl::parse_api(std::tuple<_Args2 ...>, R)::<lambda(auto:65)> [with auto:65 = iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >; R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]’ /usr/include/iod/foreach.hh:116:29: required from ‘decltype(auto) iod::internal::tuple_foreach(F, T1&&, T&& ...) [with F = sl::parse_api(std::tuple<_Args2 ...>, R) [with R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:65)>; T1 = std::tuple<iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> > >&; T = {}]’ /usr/include/iod/foreach.hh:146:44: required from ‘decltype(auto) iod::internal::foreach_tuple_caller::run(F, std::index_sequence<I ...>) [with F = sl::parse_api(std::tuple<_Args2 ...>, R) [with R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:65)>; long unsigned int ...I = {0ul}; T = std::tuple<std::tuple<iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> > >&>; std::index_sequence<I ...> = std::integer_sequence<long unsigned int, 0ul>]’ /usr/include/iod/foreach.hh:152:76: required from ‘decltype(auto) iod::internal::foreach_tuple_caller::operator|(F) [with F = sl::parse_api(std::tuple<_Args2 ...>, R) [with R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:65)>; T = std::tuple<std::tuple<iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> > >&>]’ /usr/include/silicon/api.hh:208:25: required from ‘auto sl::parse_api(std::tuple<_Args2 ...>, R) [with R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]’ /usr/include/silicon/backends/ws_api.hh:150:21: required from ‘auto sl::ws_api(P ...) [with P = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]’ ../main.cpp:110:5: required from here /usr/include/silicon/api.hh:216:29: error: no matching function for call to ‘route_cat(sl::ws_route<>&, iod::function_call_exp<s::_broadcast_t, s::_message_t>&)’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/silicon/api.hh:12:0, from ../main.cpp:39: /usr/include/silicon/http_route.hh:284:8: note: candidate: template<class ... R1, class ... R2> auto sl::route_cat(const sl::http_route<R1 ...>&, const sl::http_route<R2 ...>&) auto route_cat(const http_route<R1...>& r1, ^~~~~~~~~ /usr/include/silicon/http_route.hh:284:8: note: template argument deduction/substitution failed: In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh:216:29: note: ‘sl::ws_route<>’ is not derived from ‘const sl::http_route<R1 ...>’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/silicon/api.hh:12:0, from ../main.cpp:39: /usr/include/silicon/http_route.hh:291:8: note: candidate: template<class ... R1, class R2> auto sl::route_cat(const sl::http_route<R1 ...>&, const R2&) auto route_cat(const http_route<R1...>& r1, ^~~~~~~~~ /usr/include/silicon/http_route.hh:291:8: note: template argument deduction/substitution failed: In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh:216:29: note: ‘sl::ws_route<>’ is not derived from ‘const sl::http_route<R1 ...>’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/silicon/api.hh:13:0, from ../main.cpp:39: /usr/include/silicon/rmq_route.hh:164:7: note: candidate: template<class ... R1, class ... R2> auto sl::route_cat(const sl::rmq::route<R1 ...>&, const sl::rmq::route<R2 ...>&) auto route_cat(rmq::route<R1...> const & r1, ^~~~~~~~~ /usr/include/silicon/rmq_route.hh:164:7: note: template argument deduction/substitution failed: In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh:216:29: note: ‘sl::ws_route<>’ is not derived from ‘const sl::rmq::route<R1 ...>’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/silicon/api.hh:13:0, from ../main.cpp:39: /usr/include/silicon/rmq_route.hh:171:7: note: candidate: template<class ... R1, class R2> auto sl::route_cat(const sl::rmq::route<R1 ...>&, const R2&) auto route_cat(rmq::route<R1...> const & r1, ^~~~~~~~~ /usr/include/silicon/rmq_route.hh:171:7: note: template argument deduction/substitution failed: In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh:216:29: note: ‘sl::ws_route<>’ is not derived from ‘const sl::rmq::route<R1 ...>’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh:136:8: note: candidate: template<class S, class P, class L, class R> auto sl::route_cat(sl::ws_route<S, P>, const iod::mult_exp<L, R>&) auto route_cat(ws_route<S, P> r, const iod::mult_exp<L, R>& e) ^~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:136:8: note: template argument deduction/substitution failed: In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh:216:29: note: ‘iod::function_call_exp<s::_broadcast_t, s::_message_t>’ is not derived from ‘const iod::mult_exp<L, R>’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh:130:8: note: candidate: template<class S, class P, class L, class R> auto sl::route_cat(sl::ws_route<S, P>, const iod::div_exp<L, R>&) auto route_cat(ws_route<S, P> r, const iod::div_exp<L, R>& e) ^~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:130:8: note: template argument deduction/substitution failed: In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh:216:29: note: ‘iod::function_call_exp<s::_broadcast_t, s::_message_t>’ is not derived from ‘const iod::div_exp<L, R>’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh:124:8: note: candidate: template<class S, class P, class T> auto sl::route_cat(sl::ws_route<S, P>, const sl::params_t&) auto route_cat(ws_route<S, P> r, const params_t& s) ^~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:124:8: note: template argument deduction/substitution failed: In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh:216:29: note: ‘iod::function_call_exp<s::_broadcast_t, s::_message_t>’ is not derived from ‘const sl::params_t’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/silicon/remote_api.hh:4:0, from ../main.cpp:40: /usr/include/silicon/backends/ws_api.hh:118:8: note: candidate: template<class S, class P, class SS> auto sl::route_cat(sl::ws_route<S, P>, const iod::symbol&) auto route_cat(ws_route<S, P> r, const iod::symbol& s) ^~~~~~~~~ /usr/include/silicon/backends/ws_api.hh:118:8: note: template argument deduction/substitution failed: In file included from ../main.cpp:39:0: /usr/include/silicon/api.hh:216:29: note: ‘iod::function_call_exp<s::_broadcast_t, s::_message_t>’ is not derived from ‘const iod::symbol’ auto r = route_cat(route, m.left); ~~~~~~~~~^~~~~~~~~~~~~~~ ../main.cpp:110:5: error: ‘void server_api’ has incomplete type ); ^ In file included from /usr/include/iod/grammar.hh:6:0, from /usr/include/iod/sio.hh:9, from /usr/include/silicon/api.hh:4, from ../main.cpp:39: /usr/include/iod/foreach.hh: At global scope: /usr/include/iod/foreach.hh:27:5: error: ‘void iod::internal::tuple_foreach_impl(std::enable_if_t<std::is_same<void, Ret>::value>, std::index_sequence<TSize ...>, F, T&& ...) [with Ret = void; F = sl::parse_api(std::tuple<_Args2 ...>, R) [with R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:65)>; long unsigned int ...TSize = {0ul}; long unsigned int ...Nargs = {}; T = {std::tuple<iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> > >&}; std::enable_if_t<std::is_same<void, Ret>::value> = void; std::index_sequence<TSize ...> = std::integer_sequence<long unsigned int, 0ul>]’, declared using local type ‘sl::parse_api(std::tuple<_Args2 ...>, R) [with R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:65)>’, is used but never defined [-fpermissive] tuple_foreach_impl(std::enable_if_t<std::is_same<void, Ret>::value>, ^~~~~~~~~~~~~~~~~~ /usr/include/iod/foreach.hh:27:5: warning: ‘void iod::internal::tuple_foreach_impl(std::enable_if_t<std::is_same<void, Ret>::value>*, std::index_sequence<TSize ...>, F, T&& ...) [with Ret = void; F = sl::parse_api(std::tuple<_Args2 ...>, R) [with R = sl::ws_route<>; T = {iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> >}]::<lambda(auto:65)>; long unsigned int ...TSize = {0ul}; long unsigned int ...Nargs = {}; T = {std::tuple<iod::assign_exp<iod::function_call_exp<s::_broadcast_t, s::_message_t>, main(int, char**)::<lambda(auto:136)> > >&}]’ used but never defined make: *** [main.o] Error 1 subdir.mk:18: recipe for target 'main.o' failed

    09:55:28 Build Finished (took 6s.682ms)

    I did fix the bug that a set was not regonized by adding the required include.

    opened by stkrwork 5
  • link error when compiling benchmark/

    link error when compiling benchmark/

    A lots of errors like: /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libgnutls.a(sha-x86-ssse3.o):(.data.rel.ro+0x18): undefined reference to `nettle_sha256_init'

    I have nettle_dev and libnettle4 installed. What else are missing?

    opened by byzhang 5
  • Possibility to add a custom HTTP header ?

    Possibility to add a custom HTTP header ?

    Hi,

    I wanted to know if it's possible to add a custom HTTP header for response-header -- I mean, to the server (I'm using Ajax to get data from C++ API).

    My only solution here, is to make Silicon running behind a reverse proxy (nginx, where I can put the custom header).

    Thank you.

    opened by zxvfxwing 4
  • double as post parameter throws ::boost::bad_lexical_cast

    double as post parameter throws ::boost::bad_lexical_cast

    POST / _product_in_stock * post_parameters(_product_id = int(),
                                              _price = double()) = [] (auto p) {
       cout << "price = " << p.price << endl;
    }
    

    Next implementing request: URL = http://192.168.1.10/product_in_stock Headers = Content-Type:application/json Method = POST Body:

    {
    	"product_id":1,
    	"price":1.5
    }
    

    Exception is thrown:

    libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injectorboost::bad_lexical_cast >: bad lexical cast: source type value could not be interpreted as target

    opened by fnc12 4
  • "type_string" output of vector

    `#include

    include <silicon/api.hh>

    include <silicon/api_description.hh>

    include "symbols.hh"

    using namespace sl; // Silicon namespace using namespace s; // Symbols namespace

    int main() { typedef decltype(D(_name = std::string(), _age = int(), _city = std::string())) User;

    User u("John", 23, "NYC");
    std::vector<User> ul;
    ul.push_back(u);
    std::cout << "-----type_string(User)-----" <<std::endl;
    std::cout << type_string( &u ) <<std::endl;
    std::cout << "-----type_string(std::vector<user>)-----" <<std::endl;
    std::cout << type_string( &ul ) <<std::endl;
    
    return 0;
    

    }`

    out put :

    -----type_string(User)-----
    {name: string, age: int, city: string}
    -----type_string(std::vector<user>)-----
    vector of void
    

    Is there some way to make "type_string(std::vector*)" to output "vector of {name: string, age: int, city: string}"

    opened by 84356813 3
  • Fedora 23 fails compilation

    Fedora 23 fails compilation

    I tried to compile Silicon on Fedora 23 and I got this return:

    [[email protected] silicon]$ ./install.sh ~/local/silicon
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/leandro/local/src/silicon/silicon_build
    Install the project...
    -- Install configuration: ""
    -- Up-to-date: /home/leandro/local/silicon/include/silicon
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/procedure_desc.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/sql_crud.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/hash.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middleware_factories.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/http_route.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/service.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/utils.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/optional.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/dynamic_routing_table.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/get_parameters.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/mysql_connection.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/sql_orm.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/sqlite_orm.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/hashmap_session.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/mysql_orm.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/mysql_types.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/sqlite_connection.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/tracking_cookie.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/sqlite_types.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/mysql_session.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/sql_session.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares/sqlite_session.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/clients
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/clients/libcurl_client.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/clients/javascript_client.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/clients/templates
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/clients/templates/javascript_websocket.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/clients/templates/javascript.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/null.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/wspp_connection.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/mimosa.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/websocketpp.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/mhd.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/h2o.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/ws_api.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/websocketpp_remote_client.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/ws_route.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/cppnet.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends/lwan.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/response.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/api_to_sio.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/di_factories.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/api_description.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/remote_api.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/error.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/file.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/api.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/blob.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/base_64.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/sql_rest.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/symbols.hh
    -- Up-to-date: /home/leandro/local/silicon/include/silicon
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/middlewares
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/clients
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/clients/templates
    -- Up-to-date: /home/leandro/local/silicon/include/silicon/backends
    mkdir: cannot create directory ‘externals’: File exists
    fatal: destination path 'iod' already exists and is not an empty directory.
    -- Boost version: 1.58.0
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/leandro/local/src/silicon/silicon_build/externals/iod/silicon_build
    [ 13%] Building CXX object tests/CMakeFiles/bind_method.dir/bind_method.cc.o
    [ 13%] Built target iod_generate_symbols
    [ 22%] Built target apply
    [ 31%] Built target callable_traits
    [ 50%] Built target deep_merge
    [ 50%] Built target core
    [ 59%] Built target di
    [ 77%] Built target foreach
    [ 77%] Built target readme
    [ 86%] Built target json
    [ 95%] Built target tuple
    clang: error: unable to execute command: Segmentation fault (core dumped)
    clang: error: clang frontend command failed due to signal (use -v to see invocation)
    clang version 3.7.0 (tags/RELEASE_370/final)
    Target: x86_64-redhat-linux-gnu
    Thread model: posix
    clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
    clang: note: diagnostic msg: 
    ********************
    
    PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
    Preprocessed source(s) and associated run script(s) are located at:
    clang: note: diagnostic msg: /tmp/bind_method-17bdc5.cpp
    clang: note: diagnostic msg: /tmp/bind_method-17bdc5.sh
    clang: note: diagnostic msg: 
    
    ********************
    tests/CMakeFiles/bind_method.dir/build.make:62: recipe for target 'tests/CMakeFiles/bind_method.dir/bind_method.cc.o' failed
    make[2]: *** [tests/CMakeFiles/bind_method.dir/bind_method.cc.o] Error 254
    CMakeFiles/Makefile2:195: recipe for target 'tests/CMakeFiles/bind_method.dir/all' failed
    make[1]: *** [tests/CMakeFiles/bind_method.dir/all] Error 2
    Makefile:127: recipe for target 'all' failed
    make: *** [all] Error 2
    Cannot install /home/leandro/local/silicon.
    

    I am running: Fedora 23 clang 3.7.0 libboost 1.58 libmicrohttpd 0.9.39

    opened by lemoce 3
  • MHD_http_unescape not available on homebrew OSX libmicrohttpd

    MHD_http_unescape not available on homebrew OSX libmicrohttpd

    Hi Matthieu,

    First thank you VERY much for this library, it is pretty exciting, and I'm hoping to use it a lot. To get it to work, I had to comment out (!) the call to MHD_http_unescape in mhd.hh (which effectively breaks unescaping of course). My 'homebrew' ships version 0.9.38 which does not appear to come with a user-visible unescape function.

    I'm trying to figure out what the best thing to do is here, but maybe you have some ideas already.

    Again, thanks for Silicon!

    opened by ahupowerdns 3
  • Sql fails with iteration on list of records

    Sql fails with iteration on list of records

    c("select id from users")() | [] (int &uid) { std::cout << uid << std::endl; }; fails with

    usr/include/silicon/middlewares/sqlite_connection.hh:115:9: error: no matching member function for call to 'row_to_sio'
            row_to_sio(o);
            ^~~~~~~~~~
    test.cc:36:39: note: in instantiation of function template specialization 'sl::sqlite_statement::operator|<(lambda at test.cc:36:41)>' requested here
      c("select id from users")() | [] (int &uid)
                                          ^
    /usr/include/silicon/middlewares/sqlite_connection.hh:37:10: note: candidate template ignored: could not match 'sio<type-parameter-0-0...>' against 'int'
        void row_to_sio(iod::sio<A...>& o)
    

    seems like only sio objects work with |?

    opened by lythesia 3
  • Documentation on adding new backends

    Documentation on adding new backends

    I'm on a pet project that requires a performant CoAP webserver. Since none exist I was considering using libcoap and find a frontend for doing the routing/middleware. Silicon looks to fit the build! How hard would it be to add libcoap as a Silicon backend? Are there any docs or guidance?

    Thanks!

    opened by beriberikix 0
  • Error on run time websocket broadcast

    Error on run time websocket broadcast

    when i trying to run the websocket.o with this command: ./ws 8000 i get this error message:

    terminate called after throwing an instance of 'std::length_error'
      what():  basic_string::_M_create
    [1]    3759 abort (core dumped)  ./ws 8000
    

    and some times this error:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc
    [1]    3972 abort (core dumped)  ./ws 8000
    

    i think the problem is this part of code :

      auto rclient = make_wspp_remote_client( _message * parameters(_text) );
    
      // The server websocket api accessible by the client.
      auto server_api = ws_api(
    
        // Broadcast a message to all clients.
        _broadcast * parameters(_message) = [&] (auto p) {
          for (const wspp_connection& c : users) rclient(c).message(p.message);
        }
    
        );
    
    opened by sirAlireza 0
  • CI

    CI

    Hello. Thanks for taking the time to write this and make it public. I came in via #42 but can see you use a unit testing framework.

    I've been trying to generate coverage, both by forking your repo and running your travis.yml there are errors. I wasn't sure if you knew about them, including but not limited to commands for executable files that are not installed, passing a token that can just be set via travis settings.

    I'm currently trying to fix these problems, but it seems C++ coverage is harder to generate than the same in Java, C# or scripting language.

    opened by Lewiscowles1986 3
  • Conan package

    Conan package

    Hello, Do you know about Conan? Conan is modern dependency manager for C++. And will be great if your library will be available via package manager for other developers.

    Here you can find example, how you can create package for the library.

    If you have any questions, just ask :-)

    opened by zamazan4ik 0
Releases(v0.1)
CppCMS - High Performance C++ Web Framework

CppCMS - High Performance C++ Web Framework What is CppCMS? CppCMS is a Free High Performance Web Development Framework (not a CMS) aimed at Rapid Web

Artyom Beilis 365 Aug 2, 2022
TreeFrog Framework : High-speed C++ MVC Framework for Web Application

Small but Powerful and Efficient TreeFrog Framework is a high-speed and full-stack web application framework based on C++ and Qt, which supports HTTP

TreeFrog Framework 1.1k Aug 7, 2022
🌱Light and powerful C++ web framework for highly scalable and resource-efficient web application. It's zero-dependency and easy-portable.

Oat++ News Hey, meet the new oatpp version 1.2.5! See the changelog for details. Check out the new oatpp ORM - read more here. Oat++ is a modern Web F

Oat++ 5.6k Aug 11, 2022
Experimental, scalable, high performance HTTP server

Lwan Web Server Lwan is a high-performance & scalable web server. The project web site contains more details. Build status OS Arch Release Debug Stati

Leandro A. F. Pereira 5.6k Aug 3, 2022
Drogon: A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows

English | 简体中文 | 繁體中文 Overview Drogon is a C++14/17-based HTTP application framework. Drogon can be used to easily build various types of web applicat

An Tao 7.7k Aug 4, 2022
Enduro/X Middleware Platform for Distributed Transaction Processing

endurox Build (including atmi/ubf tests) status OS Status OS Status OS Status AIX 7.1 Centos 6 FreeBSD 11 Oracle Linux 7 OSX 11.4 raspbian10_arv7l SLE

Mavimax, Ltd 109 Aug 6, 2022
Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)

Crow is C++ microframework for web. (inspired by Python Flask) #include "crow.h" int main() { crow::SimpleApp app; CROW_ROUTE(app, "/")([]()

Jaeseung Ha 6.9k Aug 13, 2022
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.

Cutelyst - The Qt Web Framework A Web Framework built on top of Qt, using the simple and elegant approach of Catalyst (Perl) framework. Qt's meta obje

Cutelyst 779 Aug 3, 2022
Tntnet is a web application server for web applications written in C++.

Tntnet is a web application server for web applications written in C++.

Tommi Mäkitalo 72 Aug 1, 2022
C library to create simple HTTP servers and Web Applications.

Onion http server library Travis status Coverity status Onion is a C library to create simple HTTP servers and Web Applications. master the developmen

David Moreno Montero 1.9k Aug 10, 2022
A high-performance REST Toolkit written in C++

Pistache Pistache is a modern and elegant HTTP and REST framework for C++. It is entirely written in pure-C++14 and provides a clear and pleasant API.

null 2.7k Aug 13, 2022
Cetus is a high performance, stable, protocol aware proxy for MySQL Group Replication.

Introduction Cetus is a high performance, stable, protocol aware proxy for MySQL Group Replication. Getting started 1. Prerequisites cmake gcc glib2-d

null 36 Jun 12, 2022
QDjango, a Qt-based C++ web framework

QDjango - a Qt-based C++ web framework Copyright (c) 2010-2015 Jeremy Lainé About QDjango is a web framework written in C++ and built on top of the Qt

Jeremy Lainé 245 Aug 5, 2022
This is a proof-of-concept of a modern C web-framework that compiles to WASM and is used for building user interfaces.

DanCing Web ?? ?? (DCW) Getting Started Dancing Web is now distributed with the Tarantella Package Manager — a tool I've made to simplify setup of pro

Danilo Chiarlone 3 Sep 11, 2021
A http/websocket server framework on linux.

The framework is a Web-Server on unix based system. Without using any third-party libraries, the framework writes from unix system calls and standard C library functions.

xingyuuchen 16 Jun 11, 2022
Pistache is a modern and elegant HTTP and REST framework for C++

Pistache is a modern and elegant HTTP and REST framework for C++. It is entirely written in pure-C++17* and provides a clear and pleasant API.

null 2.7k Aug 7, 2022
Embedded C/C++ web server

CivetWeb The official home of CivetWeb is https://github.com/civetweb/civetweb Continuous integration for Linux and macOS (Travis CI): Continuous inte

null 2.2k Aug 11, 2022
A C++11 RESTful web server library

Served Overview Served is a C++ library for building high performance RESTful web servers. Served builds upon Boost.ASIO to provide a simple API for d

Meltwater 693 Aug 5, 2022