- Notifications
You must be signed in to change notification settings - Fork14
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
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Fast, unopinionated, minimalist web framework for C++Perfect for building REST APIs
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;}
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)
add_subdirectory(thirdparty/expresscpp)# ...target_link_libraries(my_targetPRIVATE expresscpp::expresscpp)
git clone https://gitlab.com/expresscpp/expresscpp.gitcd expresscppmkdirbuildcdbuildcmake ..make -jsudo makeinstallfind_package(expresscpp)# ...target_link_libraries(my_targetPRIVATE expresscpp::expresscpp)
- boost[asio, beast, uuid]
- nlohmann/json
- libfmt
- gtest (optional)
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
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
| name | file |
|---|---|
| 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 |
| name | file |
|---|---|
| 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
| name | repo |
|---|---|
| BeastHttp | https://github.com/0xdead4ead/BeastHttp/ |
| crow (unmaintained) | https://github.com/ipkn/crow |
| Simple-Web-Server | https://gitlab.com/eidheim/Simple-Web-Server |
| restinio | https://github.com/stiffstream/restinio |
| served | https://github.com/meltwater/served |
About
Fast, unopinionated, minimalist web framework for C++ Perfect for building REST APIs
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.
