Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ramirisu/fitoria
fitoria is a modern C++20, cross-platform web framework.
https://github.com/ramirisu/fitoria
cpp cpp20 http http-server linux macos unix-domain-socket web websocket windows
Last synced: about 1 month ago
JSON representation
fitoria is a modern C++20, cross-platform web framework.
- Host: GitHub
- URL: https://github.com/ramirisu/fitoria
- Owner: Ramirisu
- License: bsl-1.0
- Created: 2022-12-15T07:08:22.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-01T04:21:11.000Z (6 months ago)
- Last Synced: 2024-07-05T15:23:12.117Z (6 months ago)
- Topics: cpp, cpp20, http, http-server, linux, macos, unix-domain-socket, web, websocket, windows
- Language: C++
- Homepage: https://ramirisu.github.io/fitoria/
- Size: 18.3 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_1_0.txt
Awesome Lists containing this project
README
# Fitoria
[![build](https://github.com/Ramirisu/fitoria/actions/workflows/build_matrix.yml/badge.svg)](https://github.com/Ramirisu/fitoria/actions/workflows/build_matrix.yml)
[![codecov](https://codecov.io/gh/Ramirisu/fitoria/branch/main/graph/badge.svg?token=YDZ6KGEV0A)](https://codecov.io/gh/Ramirisu/fitoria)
![std](https://img.shields.io/badge/std-20-blue.svg)
![platform](https://img.shields.io/badge/platform-windows%2Flinux%2Fmacos-blue)
![license](https://img.shields.io/badge/license-BSL--1.0-blue)**fitoria** is a modern C++20, cross-platform web framework.
The library is ***experimental*** and still under development, not recommended for production use.
## Table of Contents
- [Fitoria](#fitoria)
- [Table of Contents](#table-of-contents)
- [Features](#features)
- [Getting Started](#getting-started)
- [Building](#building)
- [License](#license)## Features
- Ease to use: APIs are designed based on C++20 coroutine and highly integrated with `optional` and `expected` to provide better error handling mechanisms
- Cross-platform, write once and run across Windows, Linux and MacOS
- Support HTTP/1.1
- Support SSL up to TLS 1.3
- Support Unix Domain Socket
- Support WebSocketMore details can be found in the [documentation](https://ramirisu.github.io/fitoria/)
## Getting Started
The following example demonstrates how to create a simple ``http_server`` and attach handlers to it. ([Getting Started Example](https://github.com/Ramirisu/fitoria/blob/main/example/web/basic/getting_started.cpp))
```cpp
#include
using namespace fitoria;
using namespace fitoria::web;auto hello_world() -> awaitable
{
co_return response::ok()
.set_header(http::field::content_type, mime::text_plain())
.set_body("Hello World!");
}auto echo(std::string body) -> awaitable
{
co_return response::ok()
.set_header(http::field::content_type, mime::text_plain())
.set_body(body);
}int main()
{
auto ioc = net::io_context();
auto server = http_server::builder(ioc)
.serve(route::get<"/">(hello_world))
.serve(route::post<"/echo">(echo))
.build();server.bind("127.0.0.1", 8080);
ioc.run();
}```
## Building
Platform
- Linux
- Windows
- MacOSCompiler (C++20)
- GCC 13
- MSVC 17 2022
- Clang 15Dependencies
| Library | Minimum Version | | Note |
| :------------: | :-------------: | :------: | :----------------------------------------- |
| `boost::asio` | `1.85.0` | required | |
| `boost::beast` | `1.85.0` | required | |
| `boost::json` | `1.85.0` | required | |
| `boost::url` | `1.85.0` | required | |
| `boost::pfr` | `1.85.0` | required | |
| `fmt` | `10.0.0` | required | |
| `zlib` | | optional | |
| `brotli` | | optional | |
| `openssl` | | optional | |
| `doctest` | | optional | required when `FITORIA_BUILD_TESTS=ON`. |
| `boost::scope` | `1.85.0` | optional | required when `FITORIA_BUILD_TESTS=ON`. |
| `boost::uuid` | `1.85.0` | optional | required when `FITORIA_BUILD_EXAMPLES=ON`. |CMake
| Option | Description | Value | Default |
| :------------------------------- | :--------------------------------------- | :----: | :-----: |
| FITORIA_BUILD_EXAMPLES | Build examples | ON/OFF | OFF |
| FITORIA_BUILD_TESTS | Build tests | ON/OFF | OFF |
| FITORIA_DISABLE_OPENSSL | Do not enable OpenSSL dependent features | ON/OFF | OFF |
| FITORIA_DISABLE_ZLIB | Do not enable ZLIB dependent features | ON/OFF | OFF |
| FITORIA_DISABLE_BROTLI | Do not enable Brotli dependent features | ON/OFF | OFF |
| FITORIA_DISABLE_LIBURING | Do not enable liburing | ON/OFF | OFF |
| FITORIA_ENABLE_CODECOV | Enable code coverage build | ON/OFF | OFF |
| FITORIA_ENABLE_CLANG_TIDY | Enable clang-tidy check | ON/OFF | OFF |
| FITORIA_ENABLE_ADDRESS_SANITIZER | Compile with `-fsanitize=address` | ON/OFF | OFF |```sh
git clone https://github.com/Ramirisu/fitoria.git
cd fitoria/
cmake -B build -DFITORIA_BUILD_EXAMPLES=ON -DFITORIA_BUILD_TESTS=ON
cmake --build build
cd build && ctest && cd ..```
## License
This project is distributed under the [Boost Software License 1.0](https://www.boost.org/LICENSE_1_0.txt).