Giter Site home page Giter Site logo

msrd0 / qtwebapp Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 17.0 596 KB

QtWepApp is a HTTP server library in C++, inspired by Java Servlets. Forked from: http://stefanfrings.de/qtwebapp/index-en.html

License: GNU Lesser General Public License v3.0

HTML 0.25% Smarty 0.25% C++ 93.83% C 0.41% CMake 5.00% Shell 0.26%
cpp http http-server qt qt5 qt6 webserver qtwebapp

qtwebapp's Introduction

THIS PROJECT IS NO LONGER MAINTAINED

QtWebApp Build License

This library was forked from http://stefanfrings.de/qtwebapp/index-en.html

QtWebApp is a library to develop server-side web applications in C++. It depends on Qt5, minimum required version is 5.5.

The library comes with 3 components:

  • HttpServer
  • TemplateEngine
  • Logging

Usage

This short example demonstrates how to use the library:

class DefaultRequestHandler : public HttpRequestHandler
{
public:
	void service(HttpRequest &request, HttpResponse &response);
}

void DefaultRequestHandler::service(HttpRequest &request, HttpResponse &response)
{
	response.write("<html><body><h1>" + request.getPath() + "</h1></body></html>");
}

int main(int argc, char **argv)
{
	QCoreApplication app(argc, argv);
	
	QSettings *config = new QSettings;
	// ...
	
	new HttpListener(config, new DefaultRequestHandler);
	return app.exec();
}

You can the compile it using cmake, like this:

# ...
find_package(QtWebApp REQUIRED COMPONENTS HttpServer)
add_executable(thinkofabettername main.cpp)
target_link_libraries(thinkofabettername ${QtWebApp_LIBRARIES})
# ...

Build

QtWebApp uses CMake as the build system. To compile, simply run:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
sudo make install

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.