First Commit

This commit is contained in:
2025-10-14 23:17:27 -05:00
commit f5890d070f
6 changed files with 243 additions and 0 deletions

23
examples/printargs.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include "TF_WebApp.hpp"
using namespace Tesses::Framework::Http;
using namespace Tesses::Framework;
TF_WebApp(MyApp,nullptr)
std::shared_ptr<IHttpServer> MyApp(std::vector<std::string>& args)
{
TF_WebAppSetTitle("Print Args");
return std::make_shared<CallbackServer>([&args](ServerContext& ctx)->bool {
if(ctx.path == "/")
{
std::string text = "<h1>Hello, world</h1><ul>";
for(auto item : args)
text += "<li>" + HttpUtils::HtmlEncode(item) + "</li>";
text += "</ul>";
ctx.WithMimeType("text/html").SendText(text);
return true;
}
return false;
});
}