GabHTTP is a simple HTTP server library written in C++.
- Windows SDK (includes
winsock2.handws2tcpip.h)
- POSIX standard libraries (includes
unistd.handarpa/inet.h)
- CMake 3.29 or higher
- A C++20 compatible compiler
-
Clone the repository:
git clone https://github.com/ImLimiteds/GabHTTP.git cd GabHTTP -
Create a build directory and navigate into it:
mkdir build cd build -
Run CMake to configure the project:
cmake ..
-
Build the project:
cmake --build .
Here are two simple examples of how to use GabHTTP:
#include "GabHttp.hpp"
int main() {
GabHttp:Server Gab(8000);
Gab.Route("GET", "/", [](GabHttp::Request req, GabHttp::Response res) {
res.set_body("Hello, World!");
res.set_header("Content-Type", "text/plain");
});
Gab.Start()
return 0;
}With Headers
#include "GabHttp.hpp"
int main() {
GabHttp::Server Gab(8000);
Gab.Route("GET", "/", [](GabHttp::Request req, GabHttp::Response res) {
res.set_body("Hello, World!");
res.set_header("Content-Type", "text/plain");
}, {{"Authorization", "1234"}});
Gab.Start()
return 0;
}Version: 1.1.2