https://github.com/ztgx/hoopd
✨ Nginx inspired web framework written in Modern C++
https://github.com/ztgx/hoopd
cpp11 hoopics http-server nginx web-framework
Last synced: about 1 month ago
JSON representation
✨ Nginx inspired web framework written in Modern C++
- Host: GitHub
- URL: https://github.com/ztgx/hoopd
- Owner: zTgx
- License: mit
- Created: 2020-06-06T14:28:55.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-07-16T04:56:32.000Z (almost 5 years ago)
- Last Synced: 2025-01-13T14:45:33.280Z (over 1 year ago)
- Topics: cpp11, hoopics, http-server, nginx, web-framework
- Language: C++
- Homepage: http://www.hoopics.cn
- Size: 381 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [hoopd](https://github.com/zTgx/hoopd) 
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
```c++
mkdir build && cd build && cmake .. && make
```
## Example
* Server
```c++
#include
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
```c
curl http://127.0.0.1:9527/api/v2/echo
```
* client: Or Use python
```c
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](examples/).
## Credits
- [zTgx](https://github.com/zTgx) - Author
## License
[MIT](https://github.com/zTgx/hoopd/blob/master/LICENSE)