Учимся пользоваться odb в нашем меленьком проекте
This commit was merged in pull request #3.
This commit is contained in:
28
src/restapiserver.h
Normal file
28
src/restapiserver.h
Normal 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
|
||||
Reference in New Issue
Block a user