diff --git a/.gitignore b/.gitignore
index 0539c9e855..37cf6d8b1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,8 @@ block_test.out
heap_test.out
cpu_test.txt
cover_profile_test.txt
-build.bat
\ No newline at end of file
+build.bat
+
+_examples/*.o
+_examples/*.a
+_examples/*.so
\ No newline at end of file
diff --git a/_examples/named_parameters/main.go b/_examples/named_parameters/main.go
index 7603e43b6f..8f694466fb 100644
--- a/_examples/named_parameters/main.go
+++ b/_examples/named_parameters/main.go
@@ -1,13 +1,35 @@
package main
-import "github.com/kataras/iris"
+import (
+ "strconv"
+
+ "github.com/kataras/iris"
+)
func main() {
+ // Match to /hello/iris
+ // Not match to /hello or /hello/ or /hello/iris/something
iris.Get("/hello/:name", func(c *iris.Context) {
+ // Retrieve the parameter name
name := c.Param("name")
c.Write("Hello " + name)
})
+ // Match to /profile/iris/friends/1
+ // Not match to /profile/ , /profile/iris ,
+ // Not match to /profile/iris/friends, /profile/iris/friends ,
+ // Not match to /profile/iris/friends/2/something
+ iris.Get("/profile/:fullname/friends/:friendID", func(c *iris.Context) {
+ // Retrieve the parameters fullname and friendID
+ fullname := c.Param("fullname")
+ friendID, err := c.ParamInt("friendID")
+ if err != nil {
+ // Do something with the error
+ }
+ c.HTML(" Hello " + fullname + " with friends ID " + strconv.Itoa(friendID))
+ })
+
+ // Listen to port 8080 for example localhost:8080
iris.Listen(8080)
}