// FindUsersHandler handle GET /users

FindUsersHandler handle GET /users
// FindUsersHandler handle GET / users
func FindUsersHandler(c *routing.Context) error {
	page, err := http.ParsePageParam(c)
	if err != nil {
		return http.Error(c, err.Error(), 400, UsersServiceName())
	}
	searchQuery := ""
	if c.QueryArgs().Has("q") {
		searchQuery = string(c.QueryArgs().Peek("q"))
	}
	userService := getUserService(c)
	users := userService.FindUsersByUsernameOrEmail(searchQuery, page)
	if users == nil {
		return http.Ok(c, `[]`, UsersServiceName())
	}
	userJSON, _ := json.Marshal(users)
	return http.Ok(c, string(userJSON), UsersServiceName())
}
func FindUsersHandler ( c * routing . Context ) error { page , err := http . ParsePageParam ( c ) if err != nil { return http . Error ( c , err . Error ( ) , 400 , UsersServiceName ( ) ) } searchQuery := " " if c . QueryArgs ( ) . Has ( " " ) { searchQuery = string ( c . QueryArgs ( ) . Peek ( " " ) ) } userService := getUserService ( c ) users := userService . FindUsersByUsernameOrEmail ( searchQuery , page ) if users == nil { return http . Ok ( c , `[]` , UsersServiceName ( ) ) } userJSON , _ := json . Marshal ( users ) return http . Ok ( c , string ( userJSON ) , UsersServiceName ( ) ) }
FindUsersHandler handle GET /users
FindUsersHandler handle GET / users
// Get page query parameter
 // Get search query parameter
 // Get user service
