Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fast, unopinionated, minimalist web framework for C++ Perfect for building REST APIs

License

NotificationsYou must be signed in to change notification settings

expresscpp/expresscpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast, unopinionated, minimalist web framework for C++Perfect for building REST APIs

Logo of ExpressCpp

Conanpipeline statusexpresscpp_httpLicense: MITc++17

Design goals

ExpressCpp aims to be for C++ the same as express for Node.JS including its ecosystem of middlewares and extensions.

Express and Node.JS:

constexpress=require('express');constapp=express();app.get('/',(req,res)=>res.send('Hello World!'));constport=3000;app.listen(port,()=>console.log(`Listening on port${port}!`));

ExpressCpp:

#include"expresscpp/expresscpp.hpp"intmain() {auto expresscpp = std::make_shared<expresscpp::ExpressCpp>();  expresscpp->Get("/", [](auto/*req*/,auto res) { res->Send("hello world!"); });constexpruint16_t port =3000u;  expresscpp->Listen(port,[=](auto/*ec*/) { std::cout <<"Listening on port" << port << std::endl; }).Run();return0;}

Using me

conan

conan remote add expresscpp https://api.bintray.com/conan/expresscpp/expresscpp/

add this to you conan file:

expresscpp/0.11.0@expresscpp/testing

this to your cmake:

find_package(expresscpp)# ...target_link_libraries(my_targetPRIVATE expresscpp::expresscpp)

vendoring as subdirectory

add_subdirectory(thirdparty/expresscpp)# ...target_link_libraries(my_targetPRIVATE expresscpp::expresscpp)

installing and using find_package

git clone https://gitlab.com/expresscpp/expresscpp.gitcd expresscppmkdirbuildcdbuildcmake ..make -jsudo makeinstallfind_package(expresscpp)# ...target_link_libraries(my_targetPRIVATE expresscpp::expresscpp)

Build instructions (e.g. ubuntu)

Dependencies

  • boost[asio, beast, uuid]
  • nlohmann/json
  • libfmt
  • gtest (optional)

Conan

sudo apt install -y cmake gcc-9 g++-9 python3-pip# conan for dependency managementsudo pip3 install conan --upgrademkdir -p buildcd buildcmake .. -DEXPRESSCPP_USE_CONAN_DEPENDENCIES=ONcmake --build. -j

Debian

sudo apt install -y cmake gcc-9 g++-9# get debian dependenciessudo apt install -y libboost-all-dev nlohmann-json3-dev libfmt-dev libgtest-devmkdir -p buildcd buildcmake ..cmake --build. -j

Features/Examples

namefile
url query params./example/query_params.cpp
url params./example/url_params.cpp
auth-like middleware./example/middleware_auth_like.cpp
log-like middleware./example/middleware_logger_like.cpp
error handler./example/error_handler.cpp
variadic middlewares./example/multiple_handlers.cpp
subrouting./example/router.cpp

Official Middlewares

namefile
static file provider./example/serve_static.cpp
favicon provider(embedded)./example/favicon.cpp
  • expresscpp-logger -> TODO
  • expresscpp-grpc-proxy -> TODO
  • expresscpp-reverse-proxy -> TODO
  • expresscpp-basic-auth -> TODO

Similiar projects

namerepo
BeastHttphttps://github.com/0xdead4ead/BeastHttp/
crow (unmaintained)https://github.com/ipkn/crow
Simple-Web-Serverhttps://gitlab.com/eidheim/Simple-Web-Server
restiniohttps://github.com/stiffstream/restinio
servedhttps://github.com/meltwater/served

About

Fast, unopinionated, minimalist web framework for C++ Perfect for building REST APIs

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors5


[8]ページ先頭

©2009-2025 Movatter.jp