aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8289584..562e20b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,7 +2,6 @@
#include <string>
#include <vector>
#include <iostream>
-#include <unordered_map>
#include "crow.h"
@@ -13,7 +12,6 @@
#include "GetEssen.hpp"
#include "SimpleHandlers.hpp"
#include "RelationshipHandler.hpp"
-
/* END Handlers */
int main() {
@@ -47,9 +45,7 @@ int main() {
CROW_ROUTE(app, "/")
.methods("POST"_method)
- ([&commands](
- crow::request const &request
- ) {
+ ([&commands](crow::request const &request) {
auto data = crow::json::load(request.body);
if (!data)
@@ -58,8 +54,8 @@ int main() {
if (!data.count("command"))
return crow::response(400, "malformed request: missing `command` field\n");
- std::string command = (data.count("command") ? data["command"].s() : std::string(
- "No such command!"));
+ std::string command = (data.count("command") ? data["command"].s() :
+ std::string("No such command!"));
std::string arguments = (data.count("arguments") ? data["arguments"].s() : std::string(""));
std::string session = (data.count("session") ? data["session"].s() : std::string("null"));
@@ -77,14 +73,10 @@ int main() {
Response::simple_response("No such command!", "null", false)};
});
- app.port(18080).
-
- multithreaded()
-
- .
+ app.port(18080).multithreaded().run();
- run();
+ for (auto &&it : commands)
+ delete it.description;
- std::cout << "Stopped successfully" <<
- std::endl;
+ std::cout << "Stopped successfully" << std::endl;
}