QRESTServer focuses on developing a lean and mean Qt/C++ based API server. In addition to leveraging modern C++, QRESTServer also employs Qt to promote productivity and reinforce best practices. QRESTServer allows you to create auto generated RESTfull APIs along with a Websocket server. Controllable Caching mechanisms - Both internal and centralized (based on Redis) - implemented in QRESTServer allows you create high performance APIs.
Nowadays most of the APIs are written in high-level languages such as PHP, python, GO, JS, ruby, etc. While using these high-level languages causes rapid development it will decrease performance. Fig.1 shows a performance comparison between common RESTfull API Servers
As can be seen in Fig.1 vanilla PHP is too slow and can be ignored and other frameworks are some near in results. Fig.2 show a detailed comparison ignoring PHP as a choice.
Apart from performance issue which can be ignored in most of cases, in complex tasks where there are multiple inter-communiactions betwen low-level/high-level componenets are required to respond an API call (ex. inter-communicaiton betwwen micro-services), using such langugaes make things some complex. In Targoman Translation Framework, on each call to translation API we need to first normalize/tokenize input text, then classify and choose appropiate translation engine, next call the chosen translation engine and get back results and detokenize final translation. This process requires inter-communication between at least 4 independent microservices, while high-level logic also depends on the result of intermediate micro-services results. Using QRESTServer we could embed some of these micro-services (as libraries) in the main API and avoid multiple intermediate API calls.
You may ask:
- why C++? A short answer is performance and easy integration to our other developed libraries.
- But why Qt?
Some parts of this source code were mainly derived from other OSS projects:
- QttpServer: https://github.com/supamii/QttpServer
- QJWT: https://github.com/juangburgos/QJsonWebToken
- QWebSocket: https://doc.qt.io/qt-5/qtwebsockets-examples.html
- SimpleCrypt: https://wiki.qt.io/Simple_encryption_with_SimpleCrypt
QRESTServer has been published under the terms of GNU AFFERO GENERAL PUBLIC LICENSE as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.