userver: easy::HttpBase Class Reference
Loading...
Searching...
No Matches
easy::HttpBase Class Referencefinal

#include <userver/easy.hpp>

Detailed Description

easy::HttpWith like class with erased dependencies information that should be used only in dependency registration functions; use easy::HttpWith if not making a new dependency class.

Definition at line 118 of file easy.hpp.

Classes

struct  Callback

Public Member Functions

void DefaultContentType (http::ContentType content_type)
 Sets the default Content-Type header for all the routes.
void Route (std::string_view path, Callback &&func, std::initializer_list< server::http::HttpMethod > methods)
 Register an HTTP handler by path that supports the methods HTTP methods.
template<class Component>
bool TryAddComponent (std::string_view name, std::string_view config)
 Append a component to the component list of a service.
template<class Component>
bool TryAddComponent (std::string_view name)
void DbSchema (std::string_view schema)
 Stores the schema for further retrieval from GetDbSchema().
void Port (std::uint16_t port)
 Set the HTTP server listen port, default is 8080.
void LogLevel (logging::Level level)
 Set the logging level for the service.

Static Public Member Functions

static const std::string & GetDbSchema () noexcept

Member Function Documentation

◆ DbSchema()

void easy::HttpBase::DbSchema ( std::string_view schema)

Stores the schema for further retrieval from GetDbSchema().

Definition at line 210 of file easy.cpp.

◆ DefaultContentType()

void easy::HttpBase::DefaultContentType ( http::ContentType content_type)

Sets the default Content-Type header for all the routes.

Definition at line 187 of file easy.cpp.

◆ GetDbSchema()

const std::string & easy::HttpBase::GetDbSchema ( )
staticnoexcept
Returns
the last schema that was provided to the easy::HttpWith or easy::HttpBase

Definition at line 212 of file easy.cpp.

◆ LogLevel()

void easy::HttpBase::LogLevel ( logging::Level level)

Set the logging level for the service.

Definition at line 216 of file easy.cpp.

◆ Port()

void easy::HttpBase::Port ( std::uint16_t port)

Set the HTTP server listen port, default is 8080.

Definition at line 214 of file easy.cpp.

◆ Route()

void easy::HttpBase::Route ( std::string_view path,
Callback && func,
std::initializer_list< server::http::HttpMethod > methods )

Register an HTTP handler by path that supports the methods HTTP methods.

Definition at line 189 of file easy.cpp.

◆ TryAddComponent() [1/2]

template<class Component>
bool easy::HttpBase::TryAddComponent ( std::string_view name)
inline

Definition at line 144 of file easy.hpp.

◆ TryAddComponent() [2/2]

template<class Component>
bool easy::HttpBase::TryAddComponent ( std::string_view name,
std::string_view config )
inline

Append a component to the component list of a service.

Examples
samples/easy/4_custom_dependency/main.cpp, and samples/easy/5_pg_service_template/src/main.cpp.

Definition at line 133 of file easy.hpp.

◆ HttpWith

template<class>
friend class HttpWith
friend

Definition at line 167 of file easy.hpp.


The documentation for this class was generated from the following files: