Added a prettier web interface placeholder

This commit is contained in:
Leon Etienne (ubuntu wsl) 2020-09-24 19:00:01 +02:00
parent 4f68951725
commit 17d7e743df

View File

@ -8,7 +8,7 @@ HttpServer::HttpServer()
{ {
pMgr = new mg_mgr(); pMgr = new mg_mgr();
pNc = nullptr; pNc = nullptr;
log = new Logger("WebServer"); log = new Logger("HttpServer");
return; return;
} }
@ -35,14 +35,14 @@ bool HttpServer::InitWebServer()
{ {
mg_mgr_init(pMgr, NULL); mg_mgr_init(pMgr, NULL);
log->cout << "Starting rest api server on port " << XGConfig::httpServer.port << "..."; log->cout << "Starting http-server on port " << XGConfig::httpServer.port << "...";
log->Flush(); log->Flush();
pNc = mg_bind(pMgr, XGConfig::httpServer.port.c_str(), this->EventHandler); pNc = mg_bind(pMgr, XGConfig::httpServer.port.c_str(), this->EventHandler);
if (pNc == NULL) if (pNc == NULL)
{ {
log->cout << log->Err() << "Failed to boot the http server! - Unable to bind listener! (port: " << XGConfig::httpServer.port << ")"; log->cout << log->Err() << "Failed to boot the http-server! - Unable to bind listener! (port: " << XGConfig::httpServer.port << ")";
log->Flush(); log->Flush();
return false; return false;
} }
@ -51,7 +51,7 @@ bool HttpServer::InitWebServer()
frontend_serve_opts.document_root = XGConfig::httpServer.rootdir.c_str(); frontend_serve_opts.document_root = XGConfig::httpServer.rootdir.c_str();
frontend_serve_opts.enable_directory_listing = "no"; frontend_serve_opts.enable_directory_listing = "no";
log->cout << "Started web server successfully!"; log->cout << "Started http-server successfully!";
log->Flush(); log->Flush();
isBootedSuccessfully = true; isBootedSuccessfully = true;
@ -133,7 +133,7 @@ void HttpServer::ProcessAPIRequest(mg_connection* pNc, int ev, void* p)
void HttpServer::OnExit() void HttpServer::OnExit()
{ {
log->cout << "Shutting down rest api server..."; log->cout << "Shutting down http-server...";
log->Flush(); log->Flush();
mg_mgr_free(pMgr); mg_mgr_free(pMgr);