GabHTTP is a simple HTTP server library written in C++.
- Windows SDK (includes
winsock2.h
andws2tcpip.h
)
- POSIX standard libraries (includes
unistd.h
andarpa/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