diff --git a/lint/playground/main.cc b/lint/playground/main.cc index 9f857e4..b808b56 100644 --- a/lint/playground/main.cc +++ b/lint/playground/main.cc @@ -7,18 +7,6 @@ using namespace httplib; using namespace std; -void open_url(const char* url) -{ - string cmd; -#ifdef _MSC_VER - cmd += "start "; -#else - cmd += "open "; -#endif - cmd += url; - system(cmd.c_str()); -} - function makeJSONFormatter(string& json) { auto init = make_shared(true); @@ -86,11 +74,10 @@ int main(void) } json += "}"; - res.set_content(json, "application/json"); - }); + res.set_header("Access-Control-Allow-Origin", "*"); + res.set_header("Access-Control-Allow-Methods", "POST"); - svr.get("/stop", [&](const Request& req, Response& res) { - svr.stop(); + res.set_content(json, "application/json"); }); svr.set_error_handler([](const Request& req, Response& res) { @@ -100,8 +87,6 @@ int main(void) res.set_content(buf, "text/html"); }); - open_url("http://localhost:1234"); - svr.listen("localhost", 1234); return 0;