Skip to content

ImLimiteds/GabHTTP

Repository files navigation

GabHTTP

GabHTTP is a simple HTTP server library written in C++.

Dependencies

Windows

  • Windows SDK (includes winsock2.h and ws2tcpip.h)

Unix-like systems (Linux, macOS)

  • POSIX standard libraries (includes unistd.h and arpa/inet.h)

Building the Project

Prerequisites

  • CMake 3.29 or higher
  • A C++20 compatible compiler

Steps

  1. Clone the repository:

    git clone https://github.com/ImLimiteds/GabHTTP.git
    cd GabHTTP
  2. Create a build directory and navigate into it:

    mkdir build
    cd build
  3. Run CMake to configure the project:

    cmake ..
  4. Build the project:

    cmake --build .

Usage

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

Linux Windows

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published