Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jacob3141/qtwebserver

Qt based web application server
https://github.com/jacob3141/qtwebserver

embedded lightweight qt webserver

Last synced: about 2 months ago
JSON representation

Qt based web application server

Awesome Lists containing this project

README

        

[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9WB9VJA9RGWTN)

# QtWebServer

QtWebServer is an attempt to create a high-performance Qt based web application server, ie. a web server that runs native C++/Qt code in order to deliver websites.

A perfect use-case would be providing a REST API for smaller services.

![Concept](https://github.com/cybercatalyst/qtwebserver/blob/master/qtwebserver.png "Concept")

Within the Qt app, you set up resources and bind them to physical providers, for example files or a database content. A web application object holds information on how to match uri patterns to resources, which again is accessed by a multithreaded tcp server component. The multithreaded server is an extension of Qt's QTcpServer class.

# Installation and usage

```cpp
#include
#include

#include "tcp/tcpmultithreadedserver.h"
#include "http/httpwebengine.h"
#include "http/httpiodeviceresource.h"

using namespace QtWebServer;

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

Tcp::MultithreadedServer s;
Http::WebEngine w;

w.addResource(new Http::IODeviceResource(
"/test",
new QFile("/home/jacob/text.html")));

s.setResponder(&w);
s.listen(QHostAddress::Any, 3000);
return a.exec();
}
```

You can either integrate QtWebServer into your existing application or build a whole standalone web application. There is no distinction between the webserver and the web application, you literally link your web application with your website.

Installation via qt-pods is perfectly suited for this use-case. You can update your QtWebServer version at any time and switch back flawlessly, since it will be embedded as a git submodule. It is not recommended to plain copy the QtWebServer code into your target application. In order to learn more about qt-pods, see here:

https://github.com/cybercatalyst/qt-pods

# License

Licensed under GNU AGPLv3. Available under a commercial license, too.