change TestView.csp

This commit is contained in:
an-tao 2018-05-30 13:59:12 +08:00
parent 388f97d729
commit a9b6c9896f
3 changed files with 8 additions and 1 deletions

View File

@ -17,4 +17,5 @@ endforeach()
AUX_SOURCE_DIRECTORY(static_link_example DIR_STATIC)
add_executable(webapp ${DIR_STATIC} ${VIEWSRC})
add_dependencies(webapp drogon_ctl)

View File

@ -1,3 +1,9 @@
<%inc
#include <iostream>
%>
<%c++
std::cout<<"this is a Http backend rendering Test"<<std::endl;
%>
<!DOCTYPE html>
<html>
<%c++ std::string title=@@.get<std::string>("title");%>

View File

@ -4,6 +4,6 @@ void TestViewCtl::asyncHandleHttpRequest(const HttpRequest& req,std::function<vo
//write your application logic here
drogon::HttpViewData data;
data.insert("title",std::string("TestView"));
std::unique_ptr<HttpResponse> res=std::unique_ptr<HttpResponse>(drogon::HttpResponse::newHttpViewResponse("TestViewClone",data));
std::unique_ptr<HttpResponse> res=std::unique_ptr<HttpResponse>(drogon::HttpResponse::newHttpViewResponse("TestView",data));
callback(*res);
}