mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 21:15:56 +00:00
Former-commit-id: 23f795a6b6b64745311d0630d8e630edc3f65244
This commit is contained in:
11
_examples/bootstrapper/routes/follower.go
Normal file
11
_examples/bootstrapper/routes/follower.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
// GetFollowerHandler handles the GET: /follower/{id}
|
||||
func GetFollowerHandler(ctx iris.Context) {
|
||||
id, _ := ctx.Params().GetInt64("id")
|
||||
ctx.Writef("from "+ctx.GetCurrentRoute().Path()+" with ID: %d", id)
|
||||
}
|
||||
11
_examples/bootstrapper/routes/following.go
Normal file
11
_examples/bootstrapper/routes/following.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
// GetFollowingHandler handles the GET: /following/{id}
|
||||
func GetFollowingHandler(ctx iris.Context) {
|
||||
id, _ := ctx.Params().GetInt64("id")
|
||||
ctx.Writef("from "+ctx.GetCurrentRoute().Path()+" with ID: %d", id)
|
||||
}
|
||||
11
_examples/bootstrapper/routes/index.go
Normal file
11
_examples/bootstrapper/routes/index.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
// GetIndexHandler handles the GET: /
|
||||
func GetIndexHandler(ctx iris.Context) {
|
||||
ctx.ViewData("Title", "Index Page")
|
||||
ctx.View("index.html")
|
||||
}
|
||||
11
_examples/bootstrapper/routes/like.go
Normal file
11
_examples/bootstrapper/routes/like.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
// GetLikeHandler handles the GET: /like/{id}
|
||||
func GetLikeHandler(ctx iris.Context) {
|
||||
id, _ := ctx.Params().GetInt64("id")
|
||||
ctx.Writef("from "+ctx.GetCurrentRoute().Path()+" with ID: %d", id)
|
||||
}
|
||||
13
_examples/bootstrapper/routes/routes.go
Normal file
13
_examples/bootstrapper/routes/routes.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/v12/_examples/bootstrap/bootstrap"
|
||||
)
|
||||
|
||||
// Configure registers the necessary routes to the app.
|
||||
func Configure(b *bootstrap.Bootstrapper) {
|
||||
b.Get("/", GetIndexHandler)
|
||||
b.Get("/follower/{id:int64}", GetFollowerHandler)
|
||||
b.Get("/following/{id:int64}", GetFollowingHandler)
|
||||
b.Get("/like/{id:int64}", GetLikeHandler)
|
||||
}
|
||||
Reference in New Issue
Block a user