Учимся пользоваться odb в нашем меленьком проекте

This commit was merged in pull request #3.
This commit is contained in:
2025-03-09 10:26:52 +05:00
parent 4fbe63701f
commit d47988adda
16 changed files with 932 additions and 32 deletions

28
src/restapiserver.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef RESTAPISERVER_H
#define RESTAPISERVER_H
#include <odb/database.hxx>
#include <QTcpServer>
#include <QTcpSocket>
class RestApiServer : public QTcpServer
{
Q_OBJECT
public:
explicit RestApiServer(odb::core::database& db, QObject* parent = nullptr);
void start(quint16 port = 8080);
protected:
void incomingConnection(qintptr socketDescriptor) override;
private slots:
void handleRequest();
private:
QByteArray processRequest(const QString& request);
odb::core::database& m_db;
};
#endif // RESTAPISERVER_H