Thanks to visit codestin.com
Credit goes to github.com

Skip to content

aeimi/ecewo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Effective C Essence for Web Operations

Inspired by Express.js — it’s minimalist, unopinionated, and easy-to-use (in a C kind of way).


This is a hobby project that I'm developing to improve my programming skills. So it might not be production-ready, and it doesn't have to be.

Table of Contents

Quick Start

CMakeLists.txt:

cmake_minimum_required(VERSION 3.14)
project(your_project VERSION 1.0.0 LANGUAGES C)

include(FetchContent)

FetchContent_Declare(
    ecewo
    GIT_REPOSITORY https://github.com/savashn/ecewo.git
    GIT_TAG v1.0.0
)

FetchContent_MakeAvailable(ecewo)

add_executable(server
    main.c
)

target_link_libraries(server PRIVATE ecewo)

main.c:

#include "server.h"  // To start and end the server
#include "ecewo.h"   // To use the main API

void hello_world(Req *req, Res *res) {
    send_text(res, 200, "Hello, World!");
}

void destroy_app() {
    reset_router();
}

int main() {
    init_router();
    get("/", hello_world);
    shutdown_hook(destroy_app);
    ecewo(3000);
    return 0;
}

Build:

mkdir build && cd build && cmake .. && cmake --build .

Out of The Box Features

  • Full asynchronous operations support
  • Cross-platform compatibility
  • JSON and CBOR support
  • Cookie management and optional session based authentication mechanism
  • Flexible middleware support (route-specific and global)
  • Express.js-like routing mechanism

Requirements

  • A C compiler (GCC, Clang, or MSVC)
  • CMake version 3.14 or higher

Benchmarks

Here are 'Hello World' benchmark results for several frameworks compared to Ecewo. See the source code of the benchmark test.

Framework Average Median Max P90 P95
Ecewo 166.24µs 0s 19.52ms 545.29µs 922µs
Axum 185.67µs 0s 35.9ms 549.79µs 971.5µs
Go 720.42µs 598.19µs 22.15ms 1.46ms 1.93ms
Hono 393.05µs 341.8µs 23.08ms 1ms 1.12ms
Express 1.38ms 1.08ms 18.83ms 2.83ms 3.7ms

Documentation

Refer to the docs for usage.

Example App

Here is an example blog app built with Ecewo and PostgreSQL.

License

Licensed under MIT.

About

Minimalist web framework for C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.5%
  • CMake 4.5%