mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
f5338260bb
added json list in a similar fashion to json object renamed object_type to object updated readme, index.html, and json.md to include objects and lists updated examples to be slightly cleaner and include lists replaced instances of json object (std::map and such) with the short version (object) accurate floating point number dumping (`6.0` instead of `6`) while taking 1/30th of the time (29 microseconds saved) added json list testing snuck in utf-8 middleware warning fix snuck in twitter card style for crowcpp.org site (makes social media cards look way better with a large image)
23 lines
473 B
C++
23 lines
473 B
C++
#define CROW_MAIN
|
|
#define CROW_JSON_USE_MAP
|
|
#include "crow.h"
|
|
|
|
int main()
|
|
{
|
|
crow::SimpleApp app;
|
|
|
|
// 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")
|
|
([]{
|
|
crow::json::wvalue x({{"zmessage", "Hello, World!"},
|
|
{"amessage", "Hello, World2!"}});
|
|
return x;
|
|
});
|
|
|
|
app.port(18080)
|
|
.multithreaded()
|
|
.run();
|
|
}
|