Drogon is a high-performance C++ framework for developing web applications. Designed for modern C++ (C++17 and beyond), Drogon is fast, scalable, and supports both synchronous and asynchronous programming. With its robust feature set, it’s an excellent choice for building high-performance backend servers.
- High Performance: Optimized for speed and efficiency, making it one of the fastest C++ frameworks available.
- Asynchronous and Synchronous Support: Flexible API design allows for both synchronous and asynchronous request handling.
- Built-in ORM: Simplifies database interactions with an easy-to-use Object-Relational Mapping (ORM) system.
- Template Engine: Supports embedded template languages for dynamic HTML generation.
- Full HTTP/HTTPS Support: Comprehensive support for HTTP and HTTPS protocols, including WebSocket.
- RESTful API: Native support for creating RESTful APIs, including routing and parameter handling.
- Middleware Support: Easily extend functionality with custom middleware.
- Cross-Platform: Works seamlessly on Linux, macOS, and Windows.
- C++17 compatible compiler (e.g., GCC 7+, Clang 5+, MSVC 2017+)
- CMake 3.10+
- Boost libraries
- OpenSSL (for HTTPS support)
-
Clone the Repository:
git clone https://github.com/alamjamal/drogoncpp_server/ cd drogon-backend-server
-
Build the Project:
mkdir build cd build cmake .. make
-
Run the Server:
./drogon_backend_server
Drogon allows you to define routes and handlers in a clean and straightforward manner.
#include <drogon/drogon.h>
int main() {
// Define a simple route
drogon::app().registerHandler("/hello",
[](const drogon::HttpRequestPtr &req,
std::function<void (const drogon::HttpResponsePtr &)> &&callback) {
auto resp = drogon::HttpResponse::newHttpResponse();
resp->setBody("Hello, Drogon!");
callback(resp);
});
// Run the app
drogon::app().run();
return 0;
}
drogon-backend-server/
├── CMakeLists.txt
├── src/
│ ├── main.cpp
│ ├── controllers/
│ │ ├── example_controller.h
│ │ └── example_controller.cpp
│ ├── models/
│ │ ├── example_model.h
│ │ └── example_model.cpp
│ └── views/
│ ├── example_view.html
├── include/
│ ├── example_header.h
└── README.md
For detailed documentation, please refer to the Drogon official documentation.
We welcome contributions to enhance Drogon. To contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes.
- Push your branch and create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or suggestions, feel free to open an issue or contact us at [[email protected]].
Drogon C++ Backend Server - Fast, scalable, and modern C++ web framework. Start building your high-performance backend today!