https://github.com/imdanielsp/eagle
A Minimalistic C++ Web Framework
https://github.com/imdanielsp/eagle
cpp http web-application
Last synced: about 1 year ago
JSON representation
A Minimalistic C++ Web Framework
- Host: GitHub
- URL: https://github.com/imdanielsp/eagle
- Owner: imdanielsp
- License: mit
- Created: 2020-12-09T08:16:50.000Z (over 5 years ago)
- Default Branch: mainline
- Last Pushed: 2022-06-20T18:12:42.000Z (almost 4 years ago)
- Last Synced: 2025-01-12T09:14:03.946Z (about 1 year ago)
- Topics: cpp, http, web-application
- Language: C++
- Homepage:
- Size: 103 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://app.fossa.com/projects/git%2Bgithub.com%2Fimdanielsp%2Feagle?ref=badge_shield)
# Eagle
A Minimalistic C++ Web Framework build on top of Boost Beast and ASIO
## Example
The `eagle::app` object is the main interface for installing handlers and interceptors (more on that later):
```c++
#include "eagle.hpp"
int main(argc, argv) {
eagle::app app{argc, argv};
app.handle(http::verb::get, "/hello-eagle",
[](const auto& req, auto& resp) -> bool {
resp.html() << "
Eagle!
";
return true;
});
app.start();
return 0;
}
```
Eagle also support object handlers that can encapsulate application's state:
```c++
#include "eagle.hpp"
class h : public eagle::handler_object {
public:
h() {}
virtual ~h() {}
bool get(const eagle::request&, eagle::response& resp) override {
resp.html()
<< "
Dispatched by the handler object! Count " << state_.count_++ << "
";
return true;
}
private:
struct application_state {
size_t count_{0};
} state_;
};
int main(argc, argv) {
eagle::app app{argc, argv};
h handler;
app.handle("/api/v1/users", handler);
app.start();
return 0;
}
```
## Building
Eagle uses `meson` as the build system and depends on the Boost.Beast library
```bash
$ brew install meson
$ brew install boost
$ meson builddir && cd builddir
$ meson compile
$ ./eagle
```
## Supported Method
Eagle's design principles are focus towards REST, the following methods are inherently supported in the interfaces:
- GET
- POST
- PUT
- DELETE
# Roadmap
- Hide the `boost::beast` dependecy
- Implement a message modifier interface rather than intereact with a `http::resp` directly
- Resource Id mapping
- Query parameters
- TBD
## License
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fimdanielsp%2Feagle?ref=badge_large)