-
Notifications
You must be signed in to change notification settings - Fork 0
/
WinServer.cpp
51 lines (45 loc) · 1.14 KB
/
WinServer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* @file WinServer.cpp
*
* @author John Glatts
* @brief Driver source file for the Windows web server.
* Compile using: cl WinServer.cpp WindowsServer.cpp /EHsc
* @version 0.1
* @date 2022-12-03
*
* @copyright Copyright (c) 2022
*
*/
#include "WindowsServer.h"
const char* callBackTwo() {
const char* msg =
"HTTP/1.1 200 OK\n"
"Server: JDG Server\n"
"Content-Type: text/html\n"
"Content-Length: 3000\n"
"Accept-Ranges: bytes\n"
"Connection: keep-alive\n\n"
"<h1>I Love Function Pointers!!</h1>\n";
return msg;
}
const char* callBack() {
const char* msg =
"HTTP/1.1 200 OK\n"
"Server: JDG Server\n"
"Content-Type: text/html\n"
"Content-Length: 3000\n"
"Accept-Ranges: bytes\n"
"Connection: keep-alive\n\n"
"<h1>Hello World!</h1>\n"
"<img src=\"https://ih1.redbubble.net/image.917633532.5454/flat,750x1000,075,f.jpg\">\n";
return msg;
}
int main(int argc, char* argv[]) {
WindowsServer winServer;
if (!winServer.init(argc, argv))
return 1;
winServer.addCallBack("/", callBack);
winServer.addCallBack("/test", callBackTwo);
winServer.runServer();
return 0;
}