generated from Sithas/conan_template
Успешный парсинг JSON
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ add_executable(App ./src/main.cpp
|
|||||||
./src/endpoints_handlers/RootExecutor.h
|
./src/endpoints_handlers/RootExecutor.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(App PRIVATE Boost::boost Threads::Threads mysql::concpp)
|
target_link_libraries(App PRIVATE Boost::boost Boost::json Threads::Threads mysql::concpp)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <boost/json.hpp>
|
||||||
#include <mysqlx/xdevapi.h>
|
#include <mysqlx/xdevapi.h>
|
||||||
#include <mysqlx/common/api.h>
|
#include <mysqlx/common/api.h>
|
||||||
|
|
||||||
@@ -25,7 +26,11 @@ public:
|
|||||||
boost::beast::http::request<Body, boost::beast::http::basic_fields<Allocator>>&& req
|
boost::beast::http::request<Body, boost::beast::http::basic_fields<Allocator>>&& req
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
auto metadata = user_dao_->GetAll();
|
auto body = req.body();
|
||||||
|
boost::json::object json_as_object = boost::json::parse(body).as_object();
|
||||||
|
|
||||||
|
std::string login = boost::json::serialize(json_as_object.at("login").as_string());
|
||||||
|
std::string password = boost::json::serialize(json_as_object.at("password").as_string());
|
||||||
|
|
||||||
boost::beast::http::response<ResponseType> res{
|
boost::beast::http::response<ResponseType> res{
|
||||||
boost::beast::http::status::ok, req.version()
|
boost::beast::http::status::ok, req.version()
|
||||||
|
|||||||
Reference in New Issue
Block a user