kore-doc

The kore documentation found under https://docs.kore.io/
Commits | Files | Refs | README | git clone https://git.kore.io/kore-doc.git

commit 97669887a0121501cd6ea957ed90a0efde7ad600
parent dec09080265a1dd91de2b1a1813e59e4323ce6bf
Author: Joris Vink <joris@coders.se>
Date:   Mon, 31 Aug 2020 12:25:57 +0200

Add an example on capture groups.

Diffstat:
api/python.md | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/api/python.md b/api/python.md @@ -316,18 +316,23 @@ async def validate_user(req, data): async def validate_auth(req, data): return True +def route_gethash(req, hash): + req.response(200, hash.encode()) + dom = kore.domain("kore.io", attach="server", acme=True) -dom.route("/", self.index, methods=["get"]) +dom.route("/", route_index, methods=["get"]) -dom.route("/update", self.update, methods=["post"], +dom.route("/update", route_update, methods=["post"], post={ "id" : "^[0-9]+$", "user" : validate_user } ) -dom.route("/secret", self.secret, methods=["get"], +dom.route("^/([a-f0-9]{32})$", route_gethash, methods=["get"]) + +dom.route("/secret", route_secret, methods=["get"], auth={ "type" : "header", # header or cookie are both supported. "value" : "x-header", # header name or cookie name.