From 0b36861195553ca6463d01ea770f699a403cef81 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Tue, 5 Mar 2013 02:00:27 -0500 Subject: [PATCH] Update README.md to cover parameterized route paths --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 9349b29..053dd2a 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,20 @@ A GET request to `/test` would give the response `test`. If the route path is a string instead of a regex then `_.params` will be `false`. +#### Parameterized routes + +A new (and possibly buggy) feature is parameterized routes. You can create a parameterized route path by calling `Ocean.pr` (or `Ocean.param_route`) or just doing `pr"/object/:id"` (this macro-string version is currently only available if you do `using Ocean`). Example: + +```julia +# No-using version +Ocean.get(app, Ocean.pr("/:test"), function(req, res, _) + return _.params["test"] +end) +# Using version +get(app, pr"/:test", function(req, res, _) + return _.params["test"] +end) +``` ### Request data