userver: samples/hello_service/hello_service.cpp
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
samples/hello_service/hello_service.cpp
namespace samples::hello {
class Hello final : public server::handlers::HttpHandlerBase {
public:
// `kName` is used as the component name in static config
static constexpr std::string_view kName = "handler-hello-sample";
// Component is valid after construction and is able to accept requests
using HttpHandlerBase::HttpHandlerBase;
std::string HandleRequestThrow(
return "Hello world!\n";
}
};
} // namespace samples::hello
int main(int argc, char* argv[]) {
const auto component_list =
components::MinimalServerComponentList().Append<samples::hello::Hello>();
return utils::DaemonMain(argc, argv, component_list);
}