Skip to content
/ hoopd Public

✨ Nginx inspired web framework written in Modern C++

License

Notifications You must be signed in to change notification settings

zTgx/hoopd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hoopd, Nginx inspired, and will be a simple and easy to use web framework written in modern C++.

WIP

Supported build tools versions

g++ 8.4 +
cmake 3.17 +

Feature Overview

  • Build robust and scalable RESTful APIs
  • Group APIs
  • Data binding for JSON
  • Handy functions to send variety of HTTP responses
  • Centralized HTTP error handling

Benchmarks

  • WIP

Building

mkdir build && cd build && cmake .. && make

Example

  • Server
#include <hoopd.h>

using namespace hoopd;

class Echo {
public:
    std::string echo() {
        std::string body{"Hi there; my name is hoopd, Good to see you."};
        return body;
    }
};

int main() {
    Hoopd server;
    server.set_scope("/api/v2");

    server.get("/echo", [](const http::Request& req, http::Response& res) {
        Echo e;
        std::string message = e.echo();

        std::string k{"Cache-control"};
        std::string v{"no-cache"};
        res.header.headers(k, v);
        
        res.body = message;

        req.description();
        res.description();
    });

    server.run();
}
  • client: Use curl
curl http://127.0.0.1:9527/api/v2/echo
  • client: Or Use python
python client.py
  • output
Hi there; my name is hoopd, Good to see you.

More Examples

More examples can be found in the examples directory.

Credits

License

MIT

About

✨ Nginx inspired web framework written in Modern C++

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published