Debian Codegraph @

demo/server/handlerSyncMethod.cpp

raw
1 /*
2 * Copyright (C) 2024 KylinSoft Co., Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation, either version 3 of the License, or (at your option) any later
7 * version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <unistd.h>
18
19 #include "scene.h"
20
21 Response handleSyncMethod(const Request& request) {
22 PRINT_DEBUG("method1 request: %s\n", request.toString().c_str());
23 const std::string& input1 = request.getString("input1");
24 PRINT_INFO("method1 request input1: %s\n", input1.c_str());
25
26 // sleep(30);
27 return Response::success(nlohmann::json{
28 {"aa", 11},
29 {"bb", "asdfg"},
30 {"cc", 33},
31 });
32 }
33
34 REGISTER_SERVICE_HANDLER("syncMethod", handleSyncMethod)