Repository navigation
Expand file tree
/
Copy pathnotebooks_routes.cpp
More file actions
54 lines (48 loc) · 2.04 KB
/
Copy pathnotebooks_routes.cpp
File metadata and controls
54 lines (48 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "notebooks_routes.h"
void NotebooksRoutes::setupRoutes(QHttpServer *server)
{
server->route("/notebooks",
QHttpServerRequest::Method::Options,
[](const QHttpServerRequest &req) {
Q_UNUSED(req)
return createCorsResponse("", QHttpServerResponse::StatusCode::Ok);
});
server->route("/resources",
QHttpServerRequest::Method::Options,
[](const QHttpServerRequest &req) {
Q_UNUSED(req)
return createCorsResponse("", QHttpServerResponse::StatusCode::Ok);
});
}
QHttpServerResponse NotebooksRoutes::getNotebooks(const QHttpServerRequest &request)
{
// Implementar lógica para obtener notebooks
QJsonObject response;
response["message"] = "Get notebooks endpoint";
return QHttpServerResponse(QJsonDocument(response).toJson(),
QHttpServerResponse::StatusCode::Ok);
}
QHttpServerResponse NotebooksRoutes::createNotebook(const QHttpServerRequest &request)
{
// Implementar lógica para crear notebook
QJsonObject response;
response["message"] = "Create notebook endpoint";
return QHttpServerResponse(QJsonDocument(response).toJson(),
QHttpServerResponse::StatusCode::Created);
}
QHttpServerResponse NotebooksRoutes::getResources(const QHttpServerRequest &request)
{
// Implementar lógica para obtener recursos
QJsonObject response;
response["message"] = "Get resources endpoint";
return QHttpServerResponse(QJsonDocument(response).toJson(),
QHttpServerResponse::StatusCode::Ok);
}
QHttpServerResponse NotebooksRoutes::createResource(const QHttpServerRequest &request)
{
// Implementar lógica para crear recurso
QJsonObject response;
response["message"] = "Create resource endpoint";
return QHttpServerResponse(QJsonDocument(response).toJson(),
QHttpServerResponse::StatusCode::Created);
}