Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/jacob3141/qtwebserver
- Owner: jacob3141
- License: agpl-3.0
- Created: 2013-11-20T12:34:16.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-03-22T15:06:25.000Z (10 months ago)
- Last Synced: 2024-08-04T00:04:08.561Z (5 months ago)
- Topics: embedded, lightweight, qt, webserver
- Language: C++
- Size: 268 KB
- Stars: 61
- Watchers: 11
- Forks: 24
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-qt - qtwebserver - If you need to write a web application server in Qt for some reason, this'll help you along. (Libraries / New Functionality)
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.