2021-05-12 12:45:55 +00:00
|
|
|
#define CROW_JSON_USE_MAP
|
|
|
|
#include "crow.h"
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
crow::SimpleApp app;
|
|
|
|
|
2021-11-25 11:45:38 +00:00
|
|
|
// simple json response using a map
|
|
|
|
// To see it in action enter {ip}:18080/json
|
|
|
|
// it shoud show amessage before zmessage despite adding zmessage first.
|
|
|
|
CROW_ROUTE(app, "/json")
|
|
|
|
([]
|
|
|
|
{
|
2021-08-20 00:57:21 +00:00
|
|
|
crow::json::wvalue x({{"zmessage", "Hello, World!"},
|
|
|
|
{"amessage", "Hello, World2!"}});
|
2021-11-25 11:45:38 +00:00
|
|
|
return x; });
|
2021-05-12 12:45:55 +00:00
|
|
|
|
2021-11-25 11:45:38 +00:00
|
|
|
app.port(18080)
|
|
|
|
.multithreaded()
|
|
|
|
.run();
|
2021-05-12 12:45:55 +00:00
|
|
|
}
|