Files
stupidsimcpp/main.cpp
Yggdrasil75 798a22184f jxl
2025-11-05 15:00:02 -05:00

38 lines
1.2 KiB
C++

#include <iostream>
#include <string>
#include "util/simple_httpserver.hpp"
int main(int argc, char* argv[]) {
// Check command line arguments
int port = 8080;
for (int i = 1; i < argc; ++i) {
std::string arg = argv[i];
if (arg == "--port" || arg == "-p") {
if (i + 1 < argc) {
port = std::stoi(argv[++i]);
}
} else if (arg == "--help" || arg == "-h") {
std::cout << "Usage: " << argv[0] << " [options]" << std::endl;
std::cout << "Options:" << std::endl;
std::cout << " -p, --port PORT Set server port (default: 8080)" << std::endl;
std::cout << " -h, --help Show this help message" << std::endl;
return 0;
}
}
SimpleHTTPServer server(port);
if (!server.start()) {
std::cerr << "Failed to start server on port " << port << std::endl;
return 1;
}
std::cout << "Server running on http://localhost:" << port << std::endl;
std::cout << "Open this URL in your web browser to view the dynamic gradient" << std::endl;
std::cout << "Press Ctrl+C to stop the server" << std::endl;
server.handleRequests();
return 0;
}