/* cgi example written by Amlal El Mahrouss. licensed under GPL-2 license */ #include #include #include #include #include const std::string g_not_found = R"( Uh Oh!

Uh Oh!

No HTML file were found on this directory, please seek help from your systems administrator.

Name

Refresh

astdx's Common Gateway Server.
)"; /* finally test it */ /* @brief this stub loads a 'index.html' or returns an error message if not found. */ int main(int argc, char** argv) { // ... let's assume we serve data. astdx::web::cgi_writer writer; std::stringstream ss_file; std::ifstream fp("index.html"); if (fp.good()) ss_file << fp.rdbuf(); else ss_file << g_not_found; fp.close(); writer.eval_html(ss_file); return 0; }