-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
28 lines (23 loc) · 724 Bytes
/
Copy pathmain.cpp
File metadata and controls
28 lines (23 loc) · 724 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
25
26
27
28
#include "./headers/result.hpp"
#include "./headers/server.hpp"
#include "./headers/log.hpp"
void parseCommandArgs(ServerConfig& config, int& argc, char* argv[]){
if(argc > 1){
if (std::string(argv[1]) == "-p"){
config.PORT = std::atoi(argv[2]);
if (config.PORT == 0){
Warn("Not a valid port, defaulting back to 8080.");
config.PORT = 8080;
}
}
}
}
Result result;
ServerConfig config;
int main(int argc, char* argv[]){
result.result_data();
parseCommandArgs(config, argc, argv);
Server* server = new Server(config);
server->setstaticDirectory("./public");
server->_listen();
}