mirror of
https://github.com/kataras/iris.git
synced 2025-02-09 02:34:55 +01:00
1bb76853a9
Former-commit-id: 169671a8b5b706dc8f136e68c1a060f27a2c421b
30 lines
446 B
Go
30 lines
446 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.ConfigureContainer(func(api *iris.APIContainer) {
|
|
api.Post("/{id:int}", handler)
|
|
})
|
|
app.Listen(":8080")
|
|
}
|