1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00

Bet that many of you didn't know that Iris could handle regexp-based path parameters with ease :)

Former-commit-id: d2c5564cfb99fbea5d90106be0c6d5c505d293ab
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-10-04 03:12:50 +03:00
parent efa3c8557a
commit f780159afe
6 changed files with 31 additions and 6 deletions

6
doc.go
View File

@@ -110,6 +110,12 @@ Example code:
// Method GET: http://localhost:8080/profile/anytypeofstring
app.Get("/profile/{username:string}", profileByUsername)
// Want to use a custom regex expression instead?
// Easy: app.Get("/profile/{username:string regexp(^[a-zA-Z ]+$)}")
//
// If parameter type is missing then it's string which accepts anything,
// i.e: /{paramname} it's exactly the same as /{paramname:string}.
usersRoutes := app.Party("/users", logThisMiddleware)
{
// Method GET: http://localhost:8080/users/42