#include "webframe/webframe.hpp" void handle_request(const webframe::Request& req, webframe::Response& res) { std::string body = "Hello, World!"; res.set_content_type("text/plain"); res.set_body(body); } int main() { webframe::WebApp app; app.get("/", handle_request); app.run(); return 0; }
#include "webframe/webframe.hpp" int main() { webframe::WebApp app; app.serve_static("/static", "path/to/static/files"); app.run(); return 0; }This code shows how to serve static files using CppWebFrame. The `serve_static` method is called to map the `"/static"` path to the path on the filesystem where the static files are located. CppWebFrame automatically serves the requested files when such an endpoint is accessed by the browser. The app is then run, listening on the default port, 8080. Package Library: As CppWebFrame is an open-source C++ web framework, it's available as a header-only library. This means that it does not have a separate package library and can be included in your project directly by adding the header files to your project directory or copying the files to an include directory. You can download the latest version directly from the CppWebFrame Github page.