mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
1b02f048ef
Former-commit-id: 2fb81406c6e3162991c90e0918a3cac1b77c2b54
28 lines
391 B
Go
28 lines
391 B
Go
package main
|
|
|
|
import "github.com/kataras/iris/v12"
|
|
|
|
type (
|
|
testInput struct {
|
|
Email string `json:"email"`
|
|
}
|
|
|
|
testOutput struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
)
|
|
|
|
func handler(id int, in testInput) testOutput {
|
|
return testOutput{
|
|
ID: id,
|
|
Name: in.Email,
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
app := iris.New()
|
|
app.DI().Post("/{id:int}", handler)
|
|
app.Listen(":8080")
|
|
}
|