json 524 B

12345678910111213141516171819202122
  1. <%!-ljson%><%#
  2. #include <string.h>
  3. #include <json/json.h>
  4. int64_t fib(int64_t n){
  5. return n<2 ? 1 : (fib(n-2)+fib(n-1));
  6. }
  7. %><%
  8. json_object *hello=json_object_new_object();
  9. json_object_object_add(hello, "message", json_object_new_string("Hello, World!"));
  10. const char *hello_str=json_object_to_json_string(hello);
  11. response->headers["Content-Type"]="application/json";
  12. response->headers["Server"]="cppsp/0.2";
  13. output.write(hello_str);
  14. json_object_put(hello);
  15. //waste some cpu to improve performance for wrk
  16. //fib(18);
  17. %>