调整项目架构,让框架更优化
This commit is contained in:
@@ -30,8 +30,7 @@ func main() {
|
||||
|
||||
func listUsers(w http.ResponseWriter, r *http.Request) {
|
||||
app := factory.Default()
|
||||
i18n, _ := app.I18n()
|
||||
h := commonhttp.NewHandler(w, r, commonhttp.WithI18n(i18n))
|
||||
h := app.NewHandler(w, r)
|
||||
|
||||
var req struct {
|
||||
Keyword string `json:"keyword"`
|
||||
@@ -42,11 +41,9 @@ func listUsers(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
p := h.Pagination()
|
||||
users := []User{
|
||||
{ID: 1, Name: "User1", Email: "user1@example.com"},
|
||||
{ID: 2, Name: "User2", Email: "user2@example.com"},
|
||||
}
|
||||
h.SuccessPage(users, 100)
|
||||
_ = p
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user