
Show HN: Mach – A modern C++20 web framework inspired by ASP.NET Core
Mach is a fast, lightweight web framework for building HTTP APIs in modern C++. It provides routing, controllers, request binding, validation, middleware, security utilities, configuration, logging, and more through a c…
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Mach is a fast, lightweight web framework for building HTTP APIs in modern C++. It provides routing, controllers, request binding, validation, middleware, security utilities, configuration, logging, and more through a clean, type-safe API.
Windows
Download and run the latest Mach .msi installer.
To build Mach applications, you will need:
The Mach CLI also requires the Microsoft Visual C++ Redistributable.
sudo apt install ./mach-1.0.0-amd64.deb
Mach v1.0 supports Ubuntu with GCC.
To build Mach applications, install the required development tools:
sudo apt update sudo apt install build-essential cmake
See the Installation Guide for detailed installation instructions.
mach new hello-mach cd hello-mach
Build and run it:
mach run
A minimal Mach application looks like this:
#include <mach/mach.hpp>
int main() { mach::AppBuilder builder; auto app = builder.build();
app.mapGet("/", [] { return mach::ok("Hello from Mach!"); });
return app.run(); }
Features
Fast HTTP server built for modern C++
Minimal APIs and controllers
Route parameters and query parameters
JSON request binding and serialization
Declarative request validation
Middleware
CORS and CSRF protection
Centralized error handling
Application configuration
Built-in logging
CMake integration
Command-line tooling for creating, building, and running projects
Platforms
Platform Toolchain Support
Windows MSVC Supported
Ubuntu GCC Supported
Additional platforms and toolchains may be supported in future releases.
Full documentation, guides, tutorials, and the API reference are available at:
Mach is designed to provide high HTTP throughput while keeping its API simple and expressive.
See the benchmarks for results and methodology.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。