All Projects → ipkn → Crow

ipkn / Crow

Licence: bsd-3-clause
Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to Crow

Crow
A Fast and Easy to use microframework for the web.
Stars: ✭ 1,718 (-74.04%)
Mutual labels:  webserver, crow
Ansible Role Nginx
Ansible Role - Nginx
Stars: ✭ 632 (-90.45%)
Mutual labels:  webserver
Hydra
后端一站式微服务框架,提供API、web、websocket,RPC、任务调度、消息消费服务器
Stars: ✭ 407 (-93.85%)
Mutual labels:  webserver
Wsgidav
A generic and extendable WebDAV server based on WSGI
Stars: ✭ 476 (-92.81%)
Mutual labels:  webserver
Awesome Nginx Security
🔥 A curated list of awesome links related to application security related to the environments with NGINX or Kubernetes Ingres Controller (based on NGINX)
Stars: ✭ 417 (-93.7%)
Mutual labels:  webserver
Cyberpanel
Cyber Panel - The hosting control panel for OpenLiteSpeed
Stars: ✭ 521 (-92.13%)
Mutual labels:  webserver
Httplab
The interactive web server
Stars: ✭ 3,752 (-43.31%)
Mutual labels:  webserver
Caddy Docker
Docker container for Caddy
Stars: ✭ 729 (-88.98%)
Mutual labels:  webserver
Hunchentoot
Web server written in Common Lisp
Stars: ✭ 589 (-91.1%)
Mutual labels:  webserver
Telegraph
Secure Web Server for iOS, tvOS and macOS
Stars: ✭ 474 (-92.84%)
Mutual labels:  webserver
Polaris
A cross-platform, minimalist web framework for PowerShell
Stars: ✭ 464 (-92.99%)
Mutual labels:  webserver
Embassy
Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux
Stars: ✭ 440 (-93.35%)
Mutual labels:  webserver
Martin
Blazing fast and lightweight PostGIS vector tiles server
Stars: ✭ 540 (-91.84%)
Mutual labels:  webserver
Microwebsrv
A micro HTTP Web server that supports WebSockets, html/python language templating and routing handlers, for MicroPython (used on Pycom modules & ESP32)
Stars: ✭ 420 (-93.65%)
Mutual labels:  webserver
Agoo
A High Performance HTTP Server for Ruby
Stars: ✭ 679 (-89.74%)
Mutual labels:  webserver
Binserve
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. ⚡️🦀
Stars: ✭ 401 (-93.94%)
Mutual labels:  webserver
Magento Nginx Config
Default Nginx config for Magento
Stars: ✭ 462 (-93.02%)
Mutual labels:  webserver
Dotnet Serve
Simple command-line HTTPS server for the .NET Core CLI
Stars: ✭ 481 (-92.73%)
Mutual labels:  webserver
Httperrorpages
⏩ Simple HTTP Error Page Generator
Stars: ✭ 772 (-88.33%)
Mutual labels:  webserver
Iodine
iodine - HTTP / WebSockets Server for Ruby with Pub/Sub support
Stars: ✭ 720 (-89.12%)
Mutual labels:  webserver

Crow logo

Crow is C++ microframework for web. (inspired by Python Flask)

Travis Build Coverage Status

#include "crow.h"

int main()
{
    crow::SimpleApp app;

    CROW_ROUTE(app, "/")([](){
        return "Hello world";
    });

    app.port(18080).multithreaded().run();
}

Features

  • Easy routing
    • Similiar to Flask
    • Type-safe Handlers (see Example)
  • Very Fast
  • Fast built-in JSON parser (crow::json)
  • Mustache based templating library (crow::mustache)
  • Header only
  • Provide an amalgamated header file crow_all.h with every features (Download from here)
  • Middleware support
  • Websocket support

Still in development

  • Built-in ORM

Examples

JSON Response

CROW_ROUTE(app, "/json")
([]{
    crow::json::wvalue x;
    x["message"] = "Hello, World!";
    return x;
});

Arguments

CROW_ROUTE(app,"/hello/<int>")
([](int count){
    if (count > 100)
        return crow::response(400);
    std::ostringstream os;
    os << count << " bottles of beer!";
    return crow::response(os.str());
});

Handler arguments type check at compile time

// Compile error with message "Handler type is mismatched with URL paramters"
CROW_ROUTE(app,"/another/<int>")
([](int a, int b){
    return crow::response(500);
});

Handling JSON Requests

CROW_ROUTE(app, "/add_json")
.methods("POST"_method)
([](const crow::request& req){
    auto x = crow::json::load(req.body);
    if (!x)
        return crow::response(400);
    int sum = x["a"].i()+x["b"].i();
    std::ostringstream os;
    os << sum;
    return crow::response{os.str()};
});

How to Build

If you just want to use crow, copy amalgamate/crow_all.h and include it.

Requirements

  • C++ compiler with good C++11 support (tested with g++>=4.8)

  • boost library

  • CMake for build examples

  • Linking with tcmalloc/jemalloc is recommended for speed.

  • Now supporting VS2013 with limited functionality (only run-time check for url is available.)

Building (Tests, Examples)

Out-of-source build with CMake is recommended.

mkdir build
cd build
cmake ..
make

You can run tests with following commands:

ctest

Installing missing dependencies

Ubuntu

sudo apt-get install build-essential libtcmalloc-minimal4 && sudo ln -s /usr/lib/libtcmalloc_minimal.so.4 /usr/lib/libtcmalloc_minimal.so

OSX

brew install boost google-perftools

Attributions

Crow uses the following libraries.

http-parser

https://github.com/nodejs/http-parser

http_parser.c is based on src/http/ngx_http_parse.c from NGINX copyright
Igor Sysoev.

Additional changes are licensed under the same terms as NGINX and
copyright Joyent, Inc. and other Node contributors. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE. 


qs_parse

https://github.com/bartgrantham/qs_parse

Copyright (c) 2010 Bart Grantham
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.


TinySHA1

https://github.com/mohaps/TinySHA1

TinySHA1 - a header only implementation of the SHA1 algorithm. Based on the implementation in boost::uuid::details

Copyright (c) 2012-22 SAURAV MOHAPATRA [email protected]
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
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].