You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
817 B

2 years ago
package main
import (
2 years ago
"errors"
2 years ago
"fmt"
2 years ago
"git.diulo.com/mogfee/kit"
"git.diulo.com/mogfee/kit/transport/http"
2 years ago
)
func main() {
2 years ago
app := kit.New(
kit.Name("user-server"),
kit.Server(appServer()))
2 years ago
fmt.Println("run start")
app.Run()
fmt.Println("run end")
app.Stop()
}
2 years ago
func appServer() *http.Server {
srv := http.NewServer(http.Address("localhost:9019"))
group := srv.Route("/")
group.Handle("GET", "/", func(ctx http.Context) error {
return errors.New("abc ")
})
//group.GET("/", func(ctx http.Context) error {
// return ctx.String(200, "index page")
//})
//group.GET("/hello", func(ctx http.Context) error {
// return ctx.String(200, "hello page")
//})
//group.GET("/error", func(ctx http.Context) error {
// fmt.Println("err 1")
// return errors.New(400, "BAD_REQUEST", "")
//})
return srv
}