forked from cortoproject/corto-httprouter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttprouter.cx
37 lines (33 loc) · 1.28 KB
/
httprouter.cx
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
in package corto/httprouter
use corto/httpserver
// Router template that defines route signature and match function
vstore/router Router {
base = x/parser
returnType = string
paramType = HTTP/Request
paramName = "request"
routerDataType = object,
routerDataName = "data",
elementSeparator = null
defaultType = member
defaultProcedureType = method
} :/
int16 construct()
int32 matchRoute(vstore/route route, stringseq pattern, any param, out:any routerData)
// Utility class that maps HTTP requests to route/match
Router Service: httpserver/Service :/
member path: string
int16 onRequest(HTTP/Connection c, HTTP/Request r, string uri)
int16 construct()
// Encode HTTP methods in type of the route
procedure route{
base = x/rule
options = {parentState = DECLARED}
}:/
member file: string
string defaultAction(httprouter/Service service, HTTP/Request request) method
string fileAction(httprouter/Service service, HTTP/Request request, string path, string file) method
procedure GET: base=httprouter/route options={parentState=DECLARED}
procedure POST: base=httprouter/route options={parentState=DECLARED}
procedure PUT: base=httprouter/route options={parentState=DECLARED}
procedure DELETE: base=httprouter/route options={parentState=DECLARED}