-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodel.corto
59 lines (49 loc) · 1.37 KB
/
model.corto
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
in corto.httprouter
use corto.httpserver
/** Router template that defines route signature and match function */
corto.vstore.router Router = {
base: x.parser,
return_type: string,
param_type: HTTP.Request,
param_name: "request",
router_data_type: object,
router_data_name: "data",
element_separator: null
} {
construct() int16
match_route(
corto.vstore.route route,
stringseq pattern,
any param,
out any routerData) int32
}
/** Utility class that maps HTTP requests to route/match */
Router service: httpserver.Service {
member path: string
on_request(
HTTP.Connection c,
HTTP.Request r,
string uri) int16
forward(
HTTP.Request r,
string uri) int16
}
/** Encode HTTP methods in type of the route */
procedure route = {base: x.rule, parent_state: declared} {
member file: string
method
defaultAction(
httprouter.Service service,
HTTP.Request request) string
fileAction(
httprouter.Service service,
HTTP.Request request,
string path,
string file) string
}
/** HTTP methods */
procedure
GET = {base: httprouter.route, parent_state: declared}
POST = {base: httprouter.route, parent_state: declared}
PUT = {base: httprouter.route, parent_state: declared}
DELETE = {base: httprouter.route, parent_state: declared}