-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathserver.py
More file actions
20 lines (15 loc) · 616 Bytes
/
server.py
File metadata and controls
20 lines (15 loc) · 616 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
from starlette.applications import Starlette
from starlette.routing import Mount, Route
from starlette.staticfiles import StaticFiles
from solidctf.rpc_proxy import rpc_proxy_handler
from solidctf.service import create_asgi_application
project_root = os.getcwd()
if os.environ.get("DEBUG_MODE", False):
project_root = os.path.join(project_root, "example")
routes = [
Mount("/api", app=create_asgi_application(project_root)),
Route("/eth_rpc", endpoint=rpc_proxy_handler, methods=["POST"]),
Mount("/", app=StaticFiles(directory="web/dist", html=True)),
]
app = Starlette(routes=routes)