- Requirements
- Quick Start
- Benchmarks
- Dependencies
- Running Tests
- Documentation
- Modules
- Future Features
- Example App
- Contributing
- License
- A C compiler (GCC or Clang)
- CMake version 3.14 or higher
main.c:
#include "ecewo.h"
#include <stdio.h>
void hello_world(Req *req, Res *res) {
send_text(res, OK, "Hello, World!");
}
int main(void) {
if (server_init() != 0) {
fprintf(stderr, "Failed to initialize server\n");
return 1;
}
get("/", hello_world);
if (server_listen(3000) != 0) {
fprintf(stderr, "Failed to start server\n");
return 1;
}
server_run();
return 0;
}CMakeLists.txt:
cmake_minimum_required(VERSION 3.14)
project(app VERSION 1.0.0 LANGUAGES C)
include(FetchContent)
FetchContent_Declare(
ecewo
GIT_REPOSITORY https://github.com/savashn/ecewo.git
GIT_TAG v3.0.0
)
FetchContent_MakeAvailable(ecewo)
add_executable(${PROJECT_NAME}
main.c
)
target_link_libraries(${PROJECT_NAME} PRIVATE ecewo)Build and Run:
mkdir build
cd build
cmake ..
cmake --build .
./appHere are "Hello World" benchmark results comparing several frameworks with ecewo. See the source code of the benchmark test.
- Machine: 12th Gen Intel Core i7-12700F x 20, 32GB RAM, SSD
- OS: Fedora Workstation 43
- Method:
wrk -t8 -c100 -d40s http://localhost:3000* 2, taking the second results.
| Framework | Req/Sec | Transfer/Sec |
|---|---|---|
| ecewo | 1,208,226 | 178.60 MB |
| axum | 1,192,785 | 168.35 MB |
| go | 893,248 | 115.85 MB |
| express | 93,214 | 23.20 MB |
ecewo is built on top of libuv and llhttp. They are fetched automatically by CMake, so no manual installation is required.
mkdir build
cd build
cmake -DECEWO_BUILD_TESTS=ON ..
cmake --build .
ctestRefer to the docs for usage.
ecewo-clusterfor multithreading.ecewo-cookiefor cookie management.ecewo-corsfor CORS impelentation.ecewo-fsfor file operations.ecewo-helmetfor automatically setting safety headers.ecewo-mockfor mocking requests.ecewo-postgresfor async PostgreSQL integration.ecewo-sessionfor session management.ecewo-staticfor static file serving.
- WebSocket
- TLS
- SSE
- HTTP/2
- C++ wrapper
Here is an example blog app built with ecewo and PostgreSQL.
Contributions are welcome. Please feel free to submit a pull requests or open issues for feature requests or bugs. See the CONTRIBUTING.md.
Licensed under MIT.