tesses-webserver-cpp/tesseswebserver.cpp

41 lines
760 B
C++

#include "tesseswebserver.hpp"
TESSESWEBSERVER_STATIC_DECLARATION
using namespace Tesses::WebServer;
using namespace Tesses::WebServer::ScriptEngine;
class DummyServer : public IServer
{
public:
bool Handle(ServerContext* ctx)
{
std::string resp = {};
for(auto param : ctx->queryParams.GetAll())
{
resp.append(param.first);
resp.append(": ");
resp.append(param.second);
resp.append("\r\n");
}
ctx->SetContentType("text/plain")->SendText(resp);
return true;
}
};
int main(int argc,char** argv)
{
HttpServerListener::Init();
IServer* myServer = new DummyServer();
HttpServerListener::Listen(myServer,3000);
}