8000 GitHub - micheledallerive/Espresso: Fast, (hopefully) reliable C++ HTTP web server.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert

micheledallerive/Espresso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Espresso - Simple and fast web server

Espresso is a minimalistic and easy-to-use web server written in C++. It is inspired by the popular JavaScript library, Express.js, and aims to bring similar functionality to C++ developers.

I am not a proficient C++ developer and this project has the purpose of being a learning experience for me. I am open to any suggestions and contributions.

Features

  • Routing: handle incoming requests using simple and flexible routing.
    • Supports GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, and CONNECT requests.
    • Supports URL parameters.
  • Middleware: use pre-defined or custom middleware to manipulate requests and responses.
  • Static file serving: serve static files from a specified directory.
  • ORM (WIP): a Object-Relational Mapping system to interact with a database.

Getting Started

Installation

$ git clone https://github.com/micheledallerive/Espresso.git
$ cd espresso
$ mkdir build
$ cd build
$ cmake ..
$ sudo make install

Usage

#include <espresso.h>

int main() {
    espresso::Server server;

    server.router().get("/", [](const espresso::Request &req, espresso::Response &res) {
        response.write("Hello, World!");
    });

    server.listen(3000);

    return 0;
}

This will create a new Espresso server that listens on port 3000 and responds to GET requests to the root route (/) with "Hello, World!".

The file can then be built using CMake or simply compiled with:

$ g++ main.cpp -o main -lespresso -std=c++2a

Note: the -lespresso flag is required to link the Espresso library.

Please refer to the examples directory for more examples.

Notes

Please note, that usage and functionality may be limited and some features that are present in Express may not be present in this project due to it being a learning experience, so it is not intended for production use.

About

Fast, (hopefully) reliable C++ HTTP web server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0