@@ -9,8 +9,9 @@ A modern C++ HTTP server implementation with routing, testing, and CI-driven qua
99* [ Features] ( #features )
1010* [ Usage] ( #usage )
1111* [ Project Structure] ( #project-structure )
12+ * [ Using Docker] ( #using-docker )
13+ * [ Using Nix] ( #using-nix )
1214* [ Building the Source Code] ( #building-the-source-code )
13-
1415 * [ Building for Release Mode] ( #building-for-release-mode )
1516* [ Running the Server] ( #running-the-server )
1617* [ Running the Tests] ( #running-the-tests )
@@ -33,6 +34,8 @@ A modern C++ HTTP server implementation with routing, testing, and CI-driven qua
3334 * Build verification
3435 * Automated test execution
3536 * Coverage report generation
37+ * ** Docker** for reproducible builds and containerization
38+ * ** Nix flake** for reproducible development environments
3639* ** Project tracking** using GitHub Projects (Kanban board)
3740
3841---
@@ -45,20 +48,24 @@ A modern C++ HTTP server implementation with routing, testing, and CI-driven qua
4548HttpServer server{};
4649
4750server.get_mapping(
48- " /test" , [](const HttpServer::Request &, HttpServer::Response &res) {
51+ " /test" , [](HttpServer::Request &req , HttpServer::Response &res) {
4952 res.body = "testing new api route";
5053 });
5154
52- server.post_mapping(
53- "/test2/{id}", [ ] (const HttpServer::Request &, HttpServer::Response &res) {
54- std::stringstream ss;
55- try {
56- ss << req.path_params.get_path_param("id").value() << "\n";
57- res.body = ss.str();
58- } catch (const std::bad_optional_access &e) {
59- res.body = "could not get path parameter foo";
60- }
61- });
55+ server.post_mapping(
56+ "/test2/{id}/foo/{user}",
57+ [](HttpServer::Request &req, HttpServer::Response &res) {
58+ std::stringstream ss;
59+ try {
60+ ss << "{\"id\":" << "\"" << req.path_params.get_path_param("id").value() << "\","
61+ << "\"user\":" << "\"" << req.path_params.get_path_param("user").value() << "\""
62+ << "}";
63+ res.body = ss.str();
64+ } catch (const std::bad_optional_access &e) {
65+ res.body = "could not get path parameter";
66+ }
67+ });
68+
6269
6370try {
6471 server.listen(3490); // use any port you like
8289
8390---
8491
92+ ## Using Docker
93+
94+ ``` bash
95+ # build the docker image
96+ docker build -t cpp_http_server .
97+
98+ # run a container in interactive mode
99+ # discards after use
100+ docker run --rm -it cpp_http_server
101+ ```
102+
103+ ---
104+
105+ ## Using Nix
106+
107+ The ` flake.nix ` can only be used if your system has the Nix package manager with flakes enabled.
108+
109+ ``` bash
110+ nix develop
111+ ```
112+
85113## Building the Source Code
86114
87115This project uses ** Conan** for dependency management and ** CMake** for builds.
0 commit comments