Navigation Menu

Skip to content

Commit

Permalink
Update README.md to cover parameterized route paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk committed Mar 5, 2013
1 parent cadc10e commit 0b36861
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -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

Expand Down

0 comments on commit 0b36861

Please sign in to comment.