jet example: minor

Former-commit-id: bbcb8d89e7f66465287f896d628679280ddddeba
This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-02-05 12:47:34 +02:00
parent 9c97a8a668
commit 7096050eda
2 changed files with 6 additions and 2 deletions

View File

@ -23,7 +23,7 @@ func main() {
mypath4Route.Name = "my-page4" mypath4Route.Name = "my-page4"
// same with Handle/Func // same with Handle/Func
mypath5Route := app.Handle("GET", "/mypath5/{paramfirst}/statichere/{paramsecond}/{otherparam}/anything/{something:path}", writePathHandler) mypath5Route := app.Handle("GET", "/mypath5/{paramfirst:int}/statichere/{paramsecond}/{otherparam}/anything/{something:path}", writePathHandlerPage5)
mypath5Route.Name = "my-page5" mypath5Route.Name = "my-page5"
mypath6Route := app.Get("/mypath6/{paramfirst}/{paramsecond}/statichere/{paramThirdAfterStatic}", writePathHandler) mypath6Route := app.Get("/mypath6/{paramfirst}/{paramsecond}/statichere/{paramThirdAfterStatic}", writePathHandler)
@ -64,3 +64,7 @@ func main() {
func writePathHandler(ctx iris.Context) { func writePathHandler(ctx iris.Context) {
ctx.Writef("Hello from %s.", ctx.Path()) ctx.Writef("Hello from %s.", ctx.Path())
} }
func writePathHandlerPage5(ctx iris.Context) {
ctx.Writef("Hello from %s.\nparamfirst(int)=%d", ctx.Path(), ctx.Params().GetIntDefault("paramfirst", 0))
}

View File

@ -14,7 +14,7 @@
<br /> <br />
<br /> <br />
<a href="{{urlpath("my-page5", "theParam1", "theParam2Afterstatichere", "otherParam", "matchAnythingAfterStatic")}}"> <a href="{{urlpath("my-page5", "42", "theParam2Afterstatichere", "otherParam", "matchAnythingAfterStatic")}}">
/mypath5/{paramfirst}/statichere/{paramsecond}/{otherparam}/anything/{anything:path}</a> /mypath5/{paramfirst}/statichere/{paramsecond}/{otherparam}/anything/{anything:path}</a>
<br /> <br />
<br /> <br />