This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.c
116 lines (109 loc) · 2.12 KB
/
routes.c
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "unistd.h"
#include "postgres.h"
#include <fcntl.h>
#include <utils/elog.h>
#include <sys/queue.h>
#include <event2/keyvalq_struct.h>
#include "backend.h"
#include "util.h"
#include "routes.h"
#include "content_types.h"
struct restgres_route routes[] = {
{
"root.json",
"/",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
JSON_TYPE,
NULL,
root_route_GET,
},
{
"root.spec",
"/",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
SERVER_METADATA_TYPE_V1,
NULL,
root_route_GET,
},
{
"roles",
"/roles",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
ROLE_LIST_TYPE_V1,
NULL,
roles_route_GET,
},
{
"role",
"/roles/{rolename}",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
ROLE_METADATA_TYPE_V1,
NULL,
role_route_GET,
},
{
"databases",
"/databases",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
DATABASE_LIST_TYPE_V1,
NULL,
databases_route_GET,
},
{
"database",
"/db/{dbname}",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
DATABASE_METADATA_TYPE_V1,
NULL,
db_route_GET,
},
{
"schemas",
"/db/{dbname}/schemas",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
SCHEMA_LIST_TYPE_V1,
NULL,
schemas_route_GET,
},
{
"schema",
"/db/{dbname}/schemas/{schemaname}",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
SCHEMA_METADATA_TYPE_V1,
NULL,
schema_route_GET,
},
{
"tables",
"/db/{dbname}/schemas/{schemaname}/tables",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
TABLE_LIST_TYPE_V1,
NULL,
tables_route_GET,
},
{
"table",
"/db/{dbname}/schemas/{schemaname}/tables/{tablename}",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
TABLE_METADATA_TYPE_V1,
NULL,
table_route_GET,
},
{
"table_rows",
"/db/{dbname}/schemas/{schemaname}/tables/{tablename}/rows",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
TABLE_LIST_TYPE_V1,
NULL,
table_rows_route_GET,
},
{
"table_row",
"/db/{dbname}/schemas/{schemaname}/tables/{tablename}/row/{pk}",
EVHTTP_REQ_GET | EVHTTP_REQ_HEAD,
TABLE_METADATA_TYPE_V1,
NULL,
table_row_route_GET,
},
};
int num_routes = sizeof routes / sizeof routes[0];