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

Skip to content

slw287r/ecewo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Express-C Effect 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

Requirements

  • A C compiler
  • CMake version 3.14 or higher

Quick Start

main.c:

#include "ecewo.h"
#include <stdio.h>

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

int main(void)
{
    if (server_init() != SERVER_OK)
    {
        fprintf(stderr, "Failed to initialize server\n");
        return 1;
    }

    get("/", hello_world);

    if (server_listen(3000) != SERVER_OK)
    {
        fprintf(stderr, "Failed to start server\n");
        return 1;
    }

    server_run();
    return 0;
}

CMakeLists.txt:

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

include(FetchContent)

FetchContent_Declare(
    ecewo
    GIT_REPOSITORY https://github.com/savashn/ecewo.git
    GIT_TAG v2.1.0
)

FetchContent_MakeAvailable(ecewo)

add_executable(${PROJECT_NAME}
    main.c
)

target_link_libraries(${PROJECT_NAME} PRIVATE ecewo)

Build:

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

Benchmarks

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

Lower is better.

Framework Average Median Max P90 P95
Ecewo 0.387ms 0.152ms 7.23ms 0.99ms 1.09ms
Axum 0.442ms 0.505ms 5.61ms 1.01ms 1.21ms
Go 0.958ms 0.725ms 12.62ms 1.97ms 2.48ms
Express.js 1.85ms 1.58ms 11.05ms 3.48ms 4.27ms

Documentation

Refer to the docs for usage.

Ecosystem

Example App

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

Contributing

Contributions are welcome. Please feel free to submit a pull requests or open issues for feature requests or bugs.

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 93.9%
  • CMake 6.1%