RESTinio v.0.6.6 Released!

5 views
Skip to first unread message

Yauheni Akhotnikau

unread,
Apr 14, 2020, 10:30:23 AM4/14/20
to restinio
A new version of RESTinio is available!

The main features of v.0.6.6 are:

-----

An experimental type-safe request-router that can be used as a type-safe alternative of express-like router with additional compile-time checking. That new easy_parser_router allows to write:

namespace epr = restinio::router::easy_parser_router;
router
->http_get(
   epr
::path_to_params("/api/v1/posts/",
      epr
::non_negative_decimal_number_p<std::uint64_t>(),
     
"/revisions/",
      epr
::non_negative_decimal_number_p<std::int16_t>()),
   
[](const auto & req, std::uint64_t post_id, std::int16_t rev_id) {...});

instead of:

router->http_get("/api/v1/posts/:post_id(\d{1,10})/revisions/:rev_id(\d{1,5})",
   
[](const auto & req, const auto & params) {
     
const auto post_id = restinio::cast_to<std::uint64_t>(params["post_id"]);
     
const auto rev_id = restinio::cast_to<std::int16_t>(params["rev_id"]);
   
});

More information about the new router can be found here.

-----

An ability to specify a request handler for several HTTP-methods (see #82 for a motivation). It's possible now to write routes like:

router->add_handler(
   restinio
::router::any_of_methods(
      restinio
::http_method_lock(), restinio::http_method_unlock()),
   
"/api/v1/resources/:rid",
   
[](const auto & req, const auto & params) {...});


router
->add_handler(
   restinio
::router::none_of_methods(
      restinio
::http_method_get(), restinio::http_method_post(), restinio::http_method_delete()),
   
"/api/v1/users/:user",
   
[](const auto & req, const auto & params) {...});

Those new method matchers can be used for express-like or easy_parser-based routers.

More information about method matchers is here.

-----

New RESTINIO_FMT_HEADER_ONLY CMake option added. It allows to use the compiled version of fmtlib with RESTinio.

-----

This version is already available via Conan. We sent our PR to vcpkg, RESTinio-0.6.6 will be available via vcpkg as soon as our PR will be accepted.
Reply all
Reply to author
Forward
0 new messages