-
-
Notifications
You must be signed in to change notification settings - Fork 330
Expand file tree
/
Copy path__init__.py
More file actions
71 lines (43 loc) · 1.25 KB
/
__init__.py
File metadata and controls
71 lines (43 loc) · 1.25 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from robyn import SubRouter, WebSocket, jsonify
from .di_subrouter import di_subrouter
from .file_api import static_router
sub_router = SubRouter(prefix="/sub_router")
websocket = WebSocket(sub_router, "/ws")
__all__ = ["sub_router", "websocket", "di_subrouter", "static_router"]
@websocket.on("connect")
async def connect(ws):
return "Hello world, from ws"
@websocket.on("message")
async def message():
return "Message"
@websocket.on("close")
async def close(ws):
return jsonify({"message": "closed"})
@sub_router.get("/foo")
def get_foo():
return {"message": "foo"}
@sub_router.post("/foo")
def post_foo():
return {"message": "foo"}
@sub_router.put("/foo")
def put_foo():
return {"message": "foo"}
@sub_router.delete("/foo")
def delete_foo():
return {"message": "foo"}
@sub_router.patch("/foo")
def patch_foo():
return {"message": "foo"}
@sub_router.options("/foo")
def option_foo():
return {"message": "foo"}
@sub_router.trace("/foo")
def trace_foo():
return {"message": "foo"}
@sub_router.head("/foo")
def head_foo():
return {"message": "foo"}
@sub_router.post("/openapi_test", openapi_tags=["test subrouter tag"])
def sample_subrouter_openapi_endpoint():
"""Get subrouter openapi"""
return 200