diff --git a/CHANGELOG.md b/CHANGELOG.md index 935fce2..ded0678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- ## [Unreleased] +## v1.35.3 + +### Changed + +- **CLI (new)** : Generate modern `vix.json` for header-only libraries. +- Replace deprecated `repo` field with `repository`. +- Set `type` to `"header-only"` for `--lib` template. +- Add `include`, `keywords`, and `authors` fields to generated manifest. + +### Notes + +This is a patch release improving CLI scaffolding consistency with the Vix Registry specification. +No runtime behavior changes. + ## v1.35.2 ### Fixed diff --git a/README.ja.md b/README.ja.md index f8ab9e8..87e10ff 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,10 +1,10 @@ # Vix.cpp

- Vix.cpp Banner 🔥 **新記録** -> 単一コアに固定(`taskset -c 2`)した場合、 +> 🔥 **新記録** +> 単一コアに固定(`taskset -c 2`)した場合、 > **約 九万九千 req/s** に到達し、Go を上回り、最速クラスの C++ マイクロフレームワークに並びました。 --- @@ -174,25 +174,31 @@ using namespace vix; int main() { - auto bundle = vix::make_http_and_ws("config/config.json"); - auto &[app, ws] = bundle; - - app.get("/", [](const Request &, Response &res) - { res.json({"framework", "Vix.cpp", - "message", "HTTP + WebSocket example (basic) 🚀"}); }); - - ws.on_open([&ws](auto &session) - { - (void)session; - - ws.broadcast_json("chat.system", { - "user", "server", - "text", "Welcome to Vix WebSocket! 👋" - }); }); - - vix::run_http_and_ws(app, ws, 8080); - - return 0; + // Use default config path "config/config.json" and port 8080 + vix::serve_http_and_ws([](auto &app, auto &ws) + { + // Minimal HTTP route + app.get("/", [](auto&, auto& res) { + res.json({ + "message", "Hello from Vix.cpp minimal example 👋", + "framework", "Vix.cpp" + }); + }); + + // Minimal WebSocket handler: log and echo chat.message + ws.on_typed_message( + [&ws](auto& session, + const std::string& type, + const vix::json::kvs& payload) + { + (void)session; + + if (type == "chat.message") { + ws.broadcast_json("chat.message", payload); + } + }); }); + + return 0; } ``` @@ -249,10 +255,7 @@ app.get("/search", [](Request req, Response res) { ```cpp app.get("/missing", [](Request req, Response res) { - return std::pair{ - 404, - json::o("error", "Not found") - }; + res.status(404).json({"error", "Not found"}); }); ``` diff --git a/README.md b/README.md index d4441fc..6539c1f 100644 --- a/README.md +++ b/README.md @@ -140,15 +140,13 @@ Vix handles compilation, linking, and execution automatically. - 📘 Docs: https://vixcpp.com/docs - 🌍 Website: https://vixcpp.com -- 📦 Examples: https://github.com/vixcpp/vix/tree/main/examples +- 📦 Examples: https://vixcpp.com/docs/examples --- ## Contributing Contributions are welcome. - If you care about modern C++, performance, and real-world reliability, you’ll feel at home here. - Please read the contributing guide before opening a PR. --- diff --git a/examples/http_ws/main_basic.cpp b/examples/http_ws/main_basic.cpp index 109cef3..8e8418e 100644 --- a/examples/http_ws/main_basic.cpp +++ b/examples/http_ws/main_basic.cpp @@ -19,53 +19,29 @@ using namespace vix; int main() { - // Construct the HTTP App + WebSocket Server together - // The config file path can be omitted; if omitted, - // Vix will automatically look for config/config.json. - // - auto bundle = vix::make_http_and_ws("config/config.json"); - auto &[app, ws] = bundle; - - // GET / - app.get("/", [](Request &, Response &res) - { res.json({"framework", "Vix.cpp", - "message", "HTTP + WebSocket example (basic) 🚀"}); }); - - // GET /hello/{name} - app.get("/hello/{name}", [](Request &req, Response &res) - { res.json({"greeting", "Hello " + req.param("name") + " 👋", - "powered_by", "Vix.cpp"}); }); - - // Register WebSocket event handlers - ws.on_open([&ws](auto &session) - { - (void)session; - - ws.broadcast_json("chat.system", { - "user", "server", - "text", "Welcome to Vix WebSocket! 👋" - }); }); - - // When a typed message is received: - ws.on_typed_message( - [&ws](auto &session, - const std::string &type, - const vix::json::kvs &payload) - { - (void)session; - - // Basic chat echo example - if (type == "chat.message") { - ws.broadcast_json("chat.message", payload); - } }); - - // 4) Start HTTP + WebSocket together - // This function: - // - runs the WebSocket server in a background thread - // - installs a shutdown callback on the HTTP server - // - blocks on app.run(port) - // - vix::run_http_and_ws(app, ws, 8080); + // Use default config path "config/config.json" and port 8080 + vix::serve_http_and_ws([](auto &app, auto &ws) + { + // Minimal HTTP route + app.get("/", [](auto&, auto& res) { + res.json({ + "message", "Hello from Vix.cpp minimal example 👋", + "framework", "Vix.cpp" + }); + }); + + // Minimal WebSocket handler: log and echo chat.message + ws.on_typed_message( + [&ws](auto& session, + const std::string& type, + const vix::json::kvs& payload) + { + (void)session; + + if (type == "chat.message") { + ws.broadcast_json("chat.message", payload); + } + }); }); return 0; } diff --git a/modules/cli b/modules/cli index fb8843b..758d927 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit fb8843b5192b8b657b28cf16651f66be1cb4c3b2 +Subproject commit 758d9275a50632425cc359b40345968745c8d290