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.
- 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.
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();
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.