VWeb/example/main.cpp

20 lines
406 B
C++
Raw Normal View History

2022-08-23 14:13:21 +02:00
#include <VWeb.h>
2022-08-23 16:40:57 +02:00
bool Ping(const VWeb::Request&, VWeb::Response& response) {
response << "Pong";
return true;
}
2022-08-23 14:13:21 +02:00
int main() {
2022-08-23 16:40:57 +02:00
using namespace VWeb;
2022-08-23 14:13:21 +02:00
VWeb::Server server;
2022-08-23 16:40:57 +02:00
auto& router = server.GetRouter();
router->Get("/test", [](const Request&, Response& response) {
response << "NICE";
return true;
});
router->Get("/ping", &Ping);
2022-08-23 14:13:21 +02:00
server.Start();
server.Join();
return 0;
}