patx/micropie
add more info to middleware examples
Commit b55d191 · patx · 2025-06-16T19:37:36-04:00
Comments
No comments yet.
Diff
diff --git a/examples/middleware/router.py b/examples/middleware/router.py
index fd45094..9f458c8 100644
--- a/examples/middleware/router.py
+++ b/examples/middleware/router.py
@@ -1,3 +1,10 @@
+"""
+Example of how you can implement explicit routes using middleware.
+For a comprehensive example of this (with route decorators and type
+checking see the `rest` example at
+https://github.com/patx/micropie/tree/main/examples/rest
+"""
+
import re
from typing import Dict, List, Optional, Tuple, Any
from MicroPie import App, HttpMiddleware, Request
diff --git a/examples/rest/app.py b/examples/rest/app.py
index 2e11112..3030b72 100644
--- a/examples/rest/app.py
+++ b/examples/rest/app.py
@@ -1,6 +1,7 @@
from micropie_rest import RESTApp, route
class MyApp(RESTApp):
+
@route("/api/users/{user:str}/records/{record:int}", method=["GET", "HEAD"])
async def _get_record(self, user: str, record: int):
return {"user": user, "record": record}