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:
6
doc.go
6
doc.go
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user