Skip to content

C++ 20 HTTP server built ontop of boost/beast to immitate the syntax of Express.js and C# Minimal APIs

License

Notifications You must be signed in to change notification settings

team-muppet/Muppet-Express

Repository files navigation

MuppetExpress

MuppetExpress is a lightweight C++ framework that brings the familiar ExpressJS-like syntax to C++. It allows developers to easily set up web servers with support for routes, middleware, and basic RESTful endpoints.

Simple architecture image

Key Features

  • ExpressJS-like Syntax: Set up routes and endpoints with an intuitive, JavaScript-inspired API.
  • Middleware Support: Seamlessly register and manage middleware for your web server.
  • RESTful CRUD Operations: Use the RestController class to quickly add CRUD endpoints for your data types.

Example

Here’s how simple it is to get started:

Server server(2000);

// Add middleware
server.Use([](Request& req, Response& res, std::function<void()> next) {
    std::cout << "Middleware hit!" << std::endl;
    next();
});

// Register routes
server.MapGet("/", [](Request& req, Response& res) {
    res.body() = "Hello World!";
});

// Start the server
server.run();

Getting Started

Clone the repository and run the build script to set up everything:

git clone https://gitlab.au.dk/team-muppet/muppet-express && cd muppet-express
./build.sh

This will launch a test server and open a browser with example endpoints.


MuppetExpress makes it easy to write web servers in C++ with modern features and a syntax you already know.

About

C++ 20 HTTP server built ontop of boost/beast to immitate the syntax of Express.js and C# Minimal APIs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •