-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
24 lines (24 loc) · 862 Bytes
/
test.cpp
File metadata and controls
24 lines (24 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "src/Server.h"
#include <fstream>
int main()
{
// std::ifstream file;
// file.open("test_resources/index2.html", std::ios_base::binary);
// file.seekg(0, file.end);
// size_t size = file.tellg();
// file.seekg(0, file.beg);
// char* buf = (char*)malloc(size);
// file.read(buf, size);
cW::Server()
.get("/",
[](cW::HttpRequest* req, cW::HttpResponse* res) {
// res->setHeader("Server", "cW 0.0.1");
res->send("Hello!");
// res->setHeader("Content-Type", "text/html");
// res->setHeader("Content-Length", size);
// res->onWritable(
// [=](size_t offset) { res->write(buf + offset, size - offset, size); });
})
.listen(9001)
.run(cW::MTMode::MULTIPLE_LISTENER);
}