Giter VIP home page Giter VIP logo

paozhu's Introduction

English | 简体中文

Paozhu(炮竹🧨) is a comprehensive and fast C++ web framework that integrates C++ ORM. The development speed is as fast as script languages. The framework integrates a webserver, which can natively parse HTTP/1.1 HTTP/2 JSON WebSocket protocols and GET and POST requests. The framework also distinguishes between different methods of POST requests. The framework comes with a built-in OBJ micro-object that can store data such as char, int, string, float, etc. The framework automatically parses URL and POST parameters into the micro-object, and uses URL path mapping to function mounting points. It also uses coroutines, thread pools, and database connection pools.

QQ GROUP 668296235

Discussing the joy of C++ web development with community developers.

1.Features🔥🔥🔥🔥🔥

✅ 1. Support json decode encode, not use thirdparty, support json standard
✅ 2. Support multiple domain name websites
✅ 3. Support multiple domain name ssl server
✅ 4. Support http/1.1 and http/2 protocols
✅ 5. Support WebSocket server
✅ 6. The framework comes with websocket push, which supports regular push to websocket client
✅ 7. Support httpclient get or post
✅ 8. The framework comes with an ORM. It uses the link pool method and currently supports MySQL
✅ 9. Framework has two thread pool,framework thread pool,user program runing thread pool
✅10. The framework uses asio Coroutines
✅11. The framework features that I/O uses the coroutine pool to run and thread pool to run
✅12. The framework supports compress gzip br out files
✅13. URL POST Upload Files. use client.get[] client.post[] client.files[] get
✅14. Integrated sendmail
✅15. Generating QR code requires gd and qrencode libraries
✅16. Plugin module,Hot Module Replacement
✅17. The framework supports cache Module,ORM supports Result save to cache
✅18. The controller directory cpp files annotation auto pick to url mapping
✅19. Struct or class annotation to JSON Object, json_encode json_decode function
✅20. Support full demo admin backend, visit url /admin/main
✅21. Support PHP-FPM fastcgi running, which can replace Apache, allowing PHP programmers to smoothly transition to C++development mode

2.Runtime environment

C++ standard request c++20
asio mysql libmysqlclient-dev zlib brotli(br) [options](boost gd qrencode)

3.environment configuration

3.1 MacOS

  • system requirements
>= BigSur
  • Install necessary dependencies
brew install asio
brew install mysql
brew install mysql-client
brew install zlib
brew install brotli

[options] brew install boost
[options] brew install gd
[options] brew install qrencode

3.2 Ubuntu && Fedora

  • system requirements
Ubuntu>= 20.04 , test on Fedora38, need install asan(sudo yum install libasan)

Notice: Requires gcc11 support. For more installation details, please see

4.Install

Download asio new version to project root part

|-vendor
|-CMakeLists.txt
|-asio
  |-asio
  |-asio.hpp

Directory like this

mkdir build
cd build
cmake ..
make

Use in production environment,Compile as daemon

cmake .. -DCMAKE_BUILD_TYPE=Release
make -j8

5.hosts configuration

  • viewconf/server.conffile and getmainhostvalue
  • replace /Users/hzq/paozhu path to your project path
  • open host file
sudo vim /etc/hosts

Add to the last line of the hosts file (if it is www.869869.com)

127.0.0.1 www.869869.com

6.https test

run

sudo ./bin/paozhu 

open the browser and enter http://localhost or http://www.869869.com in the address bar

for more details, please see the source code under the controller directory, which includes CRUD examples.

7.Stress testing

Use h2load and ab testing

ApacheBench test

h2load test

8.Sample Hello world

On controller directory ,testhello.cpp file

#include "orm.h"
#include "httppeer.h"
#include "testhello.h"
namespace http
{
//@urlpath(null,hello)
std::string testhello(std::shared_ptr<httppeer> peer)
{
  httppeer &client = peer->getpeer();
  client << " Hello world! 🧨 Paozhu c++ web framework ";
	
  auto users = orm::cms::User();
  try
  {
    users.where("name","admin").limit(1).fetch();
    if (users.getUserid() > 0)
    {
      client<<"<p>found:"<<users.data.name<<"</p>";
      return "";
    }
  }
  catch (std::exception &e)
  {
    client << "<p>" << e.what() << "</p>";
    return "";
  }
  return "";
}

}// namespace http

Open the browser and enter http://localhost/hello

//@urlpath(null,hello) is annotation

9.Related tutorial

  1. paozhu Principle

  2. paozhu hello world

  3. paozhu ORM

  4. paozhu view

  5. paozhu CRUD

10.Roadmap

  • 1.Improved http features, Full testing HTTP/2, Resist hackers scanning websites
  • 2.Use C++ parse JSX file , Server Side Rendering
  • 3.Httpclient Improved,Support Protocol forwarding
  • 4.Websocket client
  • 5.Support windows
  • 6.Postgres,sqlite ORM
  • 7.Support php-fpm backend
  • 8.Parsing MySQL Protocol for ORM

11.Contribute👏👋

welcome to raise issues for mutual communication, and of course, we also welcome your active PR.

12.LICENSE

Paozhu is provided under the MIT License

paozhu's People

Contributors

hggq avatar shiinasama avatar chaoii avatar heheda123123 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.