Template
21 lines
397 B
C++
21 lines
397 B
C++
#include "crow_all.h"
|
|
|
|
int main() {
|
|
crow::SimpleApp app;
|
|
|
|
CROW_ROUTE(app, "/")([]() {
|
|
return "Hello world";
|
|
});
|
|
|
|
// POST request
|
|
CROW_ROUTE(app, "/json").methods("POST"_method)([](const crow::request &req) {
|
|
auto x = crow::json::load(req.body);
|
|
if (!x) {
|
|
return crow::response(400);
|
|
}
|
|
return crow::response(1);
|
|
});
|
|
|
|
app.port(18080).multithreaded().run();
|
|
}
|