diff --git a/CHANGELOG.md b/CHANGELOG.md index d7d4cd5..10d2340 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## v1.17.0 + +### Added + +- `vix install` command to install/setup a Vix project or `.vixpkg` artifact. +- Middleware integrated into the default Vix runtime (works out-of-the-box). +- A full set of middleware-focused examples: + - Auth (API key, JWT, RBAC) + - CORS (basic/strict) + - CSRF (strict + demos) + - Rate limiting (servers + pipeline demos) + - IP filtering (servers + pipeline demos) + - Body limit + - Compression + - HTTP cache + - ETag + - Security headers + - Static files + - JSON/form/multipart parsing + - Group builder examples + +### Changed + +- Updated CMake configuration and `VixConfig.cmake` to expose the middleware stack correctly for downstream projects. +- Updated README/docs to reflect the new install workflow and middleware usage. + +### Notes + +- No breaking changes expected. + ## v1.16.1 — REPL Isolation & Stability ### ✨ Improvements diff --git a/CMakeLists.txt b/CMakeLists.txt index bf35c39..3564225 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ cmake_minimum_required(VERSION 3.20) # cmake --build build -j # ==================================================================== -project(vix VERSION 1.16.1 LANGUAGES CXX) +project(vix VERSION 1.17.1 LANGUAGES CXX) # Make find_package honor *_ROOT hints (e.g. MYSQLCPPCONN_ROOT) if (POLICY CMP0144) @@ -654,8 +654,7 @@ if (VIX_ENABLE_INSTALL) COMPATIBILITY SameMajorVersion ) - # Export flags for consumers (substituted into VixConfig.cmake) - set(VIX_HAS_ORM ${VIX_HAS_ORM}) # already computed + set(VIX_HAS_ORM ${VIX_HAS_ORM}) set(VIX_ORM_WITH_MYSQL OFF) if (VIX_HAS_ORM AND VIX_ORM_USE_MYSQL) set(VIX_ORM_WITH_MYSQL ON) diff --git a/README.md b/README.md index 8f2690b..97f2df5 100644 --- a/README.md +++ b/README.md @@ -159,61 +159,6 @@ vix> --- -## 🧮 Math Expressions - -You can type expressions directly: - -```text -1 + 2 -10 * (3 + 4) -``` - -## 🧩 JSON Support - -The REPL supports **strict JSON** using `nlohmann::json`. - -### Objects - -```text -user = {"name":"Gaspard","age":10} -user -``` - -### Arrays - -```text -nums = [1,2,3,4] -nums -``` - -## 🖨️ print / println - -### Basic output - -```text -print("Hello") -println("Hello world") -``` - -### Mix strings and expressions - -```text -x = 3 -println("x =", x) -println("x+1 =", x+1) -``` - -## ⚙️ Built-in Vix API - -The REPL exposes a built-in `Vix` object. - -### Working directory - -```text -cwd() -Vix.cwd() -``` - ### Minimal HTTP + WebSocket Server This example shows the **smallest fully working HTTP + WS hybrid server**. @@ -228,31 +173,29 @@ This example shows the **smallest fully working HTTP + WS hybrid server**. ```cpp #include -#include +#include using namespace vix; int main() { - auto bundle = vix::make_http_and_ws("config/config.json"); - auto &[app, ws] = bundle; + vix::serve_http_and_ws([](auto &app, auto &ws){ + + // HTTP + app.get("/", [](auto&, auto& res) + { + res.send("HTTP + WebSocket"); + }); + + // WebSocket + ws.on_typed_message([&ws](auto&, + const std::string& type, + const vix::json::kvs& payload){ + if (type == "ping") + ws.broadcast_json("pong", payload); + }); - 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; + }); } ``` @@ -315,11 +258,49 @@ C++20 + Asio + zero-overhead abstractions. To build **Vix.cpp** from source: +## 🐧 Linux / Ubuntu + +### Prerequisites + +```bash +sudo apt update +sudo apt install -y \ + g++-12 cmake make git \ # Build tools + libboost-all-dev \ # Boost (asio, beast) + nlohmann-json3-dev \ # JSON (nlohmann/json) + libspdlog-dev \ # Logging (spdlog) + zlib1g-dev \ # gzip / ZLIB + libmysqlcppconn-dev # Optional: MySQL Connector/C++ for ORM +``` + +Optional dependencies: + +```bash +sudo apt install -y libmysqlcppconn-dev libsqlite3-dev +``` + +--- + +## 🍎 macOS + +### Prerequisites + +Install Homebrew first, then: + +```bash +brew install cmake ninja llvm boost nlohmann-json spdlog fmt mysql sqlite3 zlib +export ZLIB_ROOT="$(brew --prefix zlib)" +``` + +### Build + ```bash git clone https://github.com/vixcpp/vix.git cd vix +git submodule update --init --recursive cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build -j +sudo cmake --install build --prefix /usr/local ``` > This builds the Vix runtime and CLI. diff --git a/modules/cli b/modules/cli index 4d951b8..2a21bb6 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit 4d951b8a2bcc10048c2f23bacb58af4e57746b5e +Subproject commit 2a21bb6a26681f48bfb25ca53abaa72c975e8c97