Files
42_INT_12_webserv/srcs/main.cpp

40 lines
895 B
C++

#include <iostream>
#include <exception>
#include <stdexcept>
#include "Webserv.hpp"
int main(int ac, char **av)
{
try
{
std::string config = (ac == 2 ? av[1] : "./default.config");
// like this just looks kinda gross, why bother creating an instance
// and not immediately parsing? like it servers no other purpose...
// what if i call parse directly in the constructor?
// oh because the constructor has no return, but still
// is there a better way?
ConfigParser configParser(config.c_str());
configParser._print_content();
std::vector<ServerConfig> servers = configParser.parse();
for (int i = 0; i < server.size(); i++)
servers[i].print_all();
// Webserv serv(configParser.parse());
// is this better or worse than using
// serv.init_virtual_servers();
// serv.start();
}
catch (std::exception& e)
{
std::cout << e.what() << '\n';
}
return (0);
}