All Projects → pkoretic → recurse

pkoretic / recurse

Licence: MIT license
Qt based micro web framework with middleware design

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to recurse

jflask
Flask-inspired web micro-framework for Java (deprecated)
Stars: ✭ 18 (-5.26%)
Mutual labels:  micro-framework, web-framework
Jooby
The modular web framework for Java and Kotlin
Stars: ✭ 1,309 (+6789.47%)
Mutual labels:  micro-framework, web-framework
Echo
High performance, minimalist Go web framework
Stars: ✭ 21,297 (+111989.47%)
Mutual labels:  micro-framework, web-framework
Giraffe
Giraffe is an F# micro web framework for building rich web applications. It has been heavily inspired and is similar to Suave, but has been specifically designed with ASP.NET Core in mind and can be plugged into the ASP.NET Core pipeline via middleware. Giraffe applications are composed of so called HttpHandler functions which can be thought of a mixture of Suave's WebParts and ASP.NET Core's middleware.
Stars: ✭ 1,703 (+8863.16%)
Mutual labels:  micro-framework, web-framework
Klein
werkzeug + twisted.web
Stars: ✭ 770 (+3952.63%)
Mutual labels:  micro-framework, web-framework
Falco
A functional-first toolkit for building brilliant ASP.NET Core applications using F#.
Stars: ✭ 214 (+1026.32%)
Mutual labels:  micro-framework, web-framework
Simplify.Web
Moved to https://github.com/SimplifyNet. Simplify.Web is a lightweight and fast server-side .NET web-framework based on MVC and OWIN for building HTTP based web-applications, RESTful APIs etc.
Stars: ✭ 23 (+21.05%)
Mutual labels:  web-framework
commix
Micro-framework for data-driven composable system architectures
Stars: ✭ 46 (+142.11%)
Mutual labels:  micro-framework
ninglex
Easy to learn, quick and dirty, bare-bones web framework for Common Lisp
Stars: ✭ 31 (+63.16%)
Mutual labels:  web-framework
inject
A web framework inspired by spring boot, base on echo framework and dependency injection
Stars: ✭ 17 (-10.53%)
Mutual labels:  web-framework
koa
A golang framework like koa.js and has the best performance with net/http.
Stars: ✭ 30 (+57.89%)
Mutual labels:  web-framework
stirfry
StirFry is a self contained and lightweight web framework for nodejs
Stars: ✭ 24 (+26.32%)
Mutual labels:  web-framework
command-pal
The hackable command palette for the web, inspired by Visual Studio Code.
Stars: ✭ 32 (+68.42%)
Mutual labels:  micro-framework
geronimo-specs
Mirror of Apache Geronimo specs
Stars: ✭ 20 (+5.26%)
Mutual labels:  web-framework
adrenaline
A PSR-7 micro framework built on top of the Adroit middleware to speed up your development ;)
Stars: ✭ 31 (+63.16%)
Mutual labels:  micro-framework
hleb
PHP Micro-Framework HLEB
Stars: ✭ 58 (+205.26%)
Mutual labels:  micro-framework
Polyel-Framework
⚡️ Voltis Core: A PHP framework based on Swoole from the ground up
Stars: ✭ 22 (+15.79%)
Mutual labels:  web-framework
rawphp
A powerful, robust and API-first, PHP framework that helps people from different PHP backgrounds work on the same project seamlessly. You can write Laravel, CakePHP, Slim, Symphone and Procedural PHP code inside it and it all works perfectly. Its the PHP Framework for everyone.
Stars: ✭ 31 (+63.16%)
Mutual labels:  micro-framework
aqua
A minimal and fast 🏃 web framework for Deno
Stars: ✭ 219 (+1052.63%)
Mutual labels:  web-framework
braid-go
简单易用的微服务框架 | Ease used microservice framework
Stars: ✭ 34 (+78.95%)
Mutual labels:  micro-framework

Recurse logo

License MIT Language (C++)

Recurse is set to be a modern web micro framework written in latest C++ (14) using Qt library leveraging all the best features of both worlds. We strongly emphasize on writing a clean and easy to understand code and avoid using templates to encourage contributions.

Recurse aims to be small with no middlewares bundled in the core. This should allow it to be very robust for writing next generation web applications and APIs.

It is inspired by Node.js koa and Express micro frameworks.

Example

#include "recurse.hpp"

int main(int argc, char *argv[])
{
    Recurse app(argc, argv);

    // logger
    app.use([](auto &ctx, auto next)
    {
        qDebug() << ctx.request.ip;
        next();
    });

    // hello world
    app.use([](auto &ctx)
    {
        ctx.response.send("Hello world");
    });

    app.listen(3000);
};

Installation

This is a header-only library. To use, just include recurse.hpp inside your project. See examples for more information.

NOTE you also need context.hpp, request.hpp, response.hpp as recurse.hpp depends on them.

Middlewares

There is no middleware bundled in the core. For example, for routing, one can use Router

#include "router.hpp"

int main(int argc, char *argv[])
{
    Recurse app(argc, argv);

    Module::Router router;

    router.GET("/hello/:user", [](auto &ctx, auto /* next */)
    {
        ctx.response.send("Hello World " + ctx.request.params["user"]);
    });

    app.listen();
}

404 - Not Found

By default, if no middleware responds, Recurse will respond with Not Found message, and 404 HTTP error code.

To make your own response, simply add new middleware at the end of the list

// if any middleware before this responds this won't get called
app.use([](auto &ctx)
{
    ctx.response.status(404).send("Custom Not Found");
});

For a complete example see 404 example

You can also have it as a first middleware (if you already have some first middleware that does your logging or similar)

app.use([](auto &ctx, auto next, auto prev)
{
    next([&ctx, prev]
    {
        // this is last code to be called before sending response to client
        if(ctx.response.status() == 404)
            ctx.response.body("Custom Not Found");

        prev();
    });
});

Styling

When writing code, please use the provided .clang-format file. There is a nice vim-clang-format plugin that you can use in vim.

You can also call it manually

clang-format -i source.hpp

# to format all files
find . -name "*.hpp" -or -name "*.cpp" | xargs clang-format -i

And you can also use shortcut command

clang-format -i -style="{BasedOnStyle: WebKit, PointerAlignment: Right, Standard: Cpp11, TabWidth: 4, UseTab: Never, BreakBeforeBraces: Allman, AllowShortFunctionsOnASingleLine: false, ContinuationIndentWidth: 0, MaxEmptyLinesToKeep: 1, NamespaceIndentation: All, AccessModifierOffset: 0}" source.hpp

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].