Skip to content

Latest commit

 

History

History
184 lines (127 loc) · 2.98 KB

File metadata and controls

184 lines (127 loc) · 2.98 KB

Vix.cpp Core Module

Native application foundation for Vix.cpp.

The Core module provides the main runtime layer used to build HTTP applications in C++ with routes, handlers, middleware, requests, responses, configuration, TLS, static files, templates, and server lifecycle management.

Documentation

Full documentation is available here:

https://docs.vixcpp.com/modules/core/

API reference:

https://docs.vixcpp.com/modules/core/api-reference

What Core provides

  • vix::App
  • HTTP server
  • Routing system
  • Request and response objects
  • Middleware
  • Route groups
  • Static files
  • Templates
  • Configuration
  • TLS support
  • Runtime executor integration
  • Async I/O integration

Public header

#include <vix.hpp>

You can also include Core directly:

#include <vix/core.hpp>

Minimal HTTP server

#include <vix.hpp>

int main()
{
  vix::App app;

  app.get("/", [](vix::Request &req, vix::Response &res)
  {
    (void)req;

    res.text("Hello from Vix");
  });

  app.run(8080);

  return 0;
}

Run:

vix run main.cpp

Open:

http://localhost:8080

JSON API example

#include <vix.hpp>

int main()
{
  vix::App app;

  app.get("/api/status", [](vix::Request &req, vix::Response &res)
  {
    (void)req;

    res.json({
      {"status", "ok"},
      {"server", "Vix.cpp"}
    });
  });

  app.run(8080);

  return 0;
}

Core architecture

App
  -> Router
  -> HTTPServer
  -> Session
  -> Transport
  -> RuntimeExecutor

Core connects the application API with the runtime, async I/O, HTTP server, routing layer, and response system.

Build

Contributors should use the Vix CLI to build this module.

Vix wraps the C++ build workflow with project detection, presets, Ninja builds, clean logs, caching, and focused diagnostics. This helps avoid hidden C++ build issues and keeps the contributor workflow consistent.

Build the project

git clone https://github.com/vixcpp/vix.git
cd vix
vix build

Build all targets

Use this before running the full test suite, install workflows, or release checks:

vix build --build-target all

Clean rebuild

Use this when the local CMake cache or build directory may be stale:

vix build --clean

Release build

vix build --preset release

Tests

Build all targets first, then run tests:

vix build --build-target all
vix tests

Before opening a pull request, use:

vix fmt --check
vix build --build-target all
vix tests

Useful links

License

MIT License.

See LICENSE for details.