Template Struct content_wrapper1

Struct Documentation

template<typename F, typename A1>
struct udho::content_wrapper1

mapping of an url with a http request defined by http method and the url pattern

A content wrapper is defined by a HTTP verb, a callback and a url pattern. A content wrapper uses a compositor that prepares a HTTP response based on the callbacks return

Note

binds a variable by reference with the mapping, which might be a database connection or some persistent stateful object

Template Parameters
  • F: callback type

  • A1: type of the passed value which will be passed by reference

Public Types

typedef content_wrapper1<F, A1> self_type

Public Functions

content_wrapper1(boost::beast::http::verb method, F ftor, A1 &a1)
template<template<typename> class CompositorT = compositors::transparent>
auto unwrap(CompositorT<typename internal::function_signature<F>::return_type> compositor = CompositorT<typename internal::function_signature<F>::return_type>())
auto raw()

raw content delivery using transparent compositor

auto operator=(const std::string &pattern)

attach an url pattern

auto mimed(std::string mime)

applies a mimed compositor on the return

Parameters
  • mime: returned mime type

auto html()

shorthand for html mime type

auto plain()

shorthand for plain text mime type

auto json()

shorthand for json mime type

Public Members

F _ftor
A1 &_a1
boost::beast::http::verb _method