From 4a82442ea3f07f449459c7d9f83e000e5062a25f Mon Sep 17 00:00:00 2001 From: Lee Cheneler Date: Thu, 21 Nov 2024 00:13:22 +0000 Subject: [PATCH] docs: updated context docs --- README.md | 21 +++++++++++++++++++++ deno.json | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d7db8f5..33ff91b 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,27 @@ context.cookies.set("name", "value"); context.cookies.delete("name"); ``` +### Parameters + +Parameters are parsed from the URL and placed on the context. + +```tsx +// /user/:id/post/:postId -> /user/1/post/2 + +context.params.id; // 1 +context.params.postId; // 2 +``` + +### Wildcards + +Wildcards are parsed from the URL and placed on the context. + +```tsx +// /public/* -> /public/one/two/three + +context.wildcard; // one/two/three +``` + ## Routing ### HTTP methods diff --git a/deno.json b/deno.json index c385c9c..729727e 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@mage/server", - "version": "0.7.1", + "version": "0.7.2", "license": "MIT", "exports": "./mod.ts", "tasks": {