mirror of
https://github.com/kataras/iris.git
synced 2025-02-10 11:06:19 +01:00
30 lines
438 B
Go
30 lines
438 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.HandleFunc(iris.MethodPost, "/{id:int}", handler)
|
||
|
app.Listen(":5000", iris.WithOptimizations)
|
||
|
}
|