@@ 8-15 (lines=8) @@ | ||
5 | add_action( 'rest_api_init', array( $this, 'register_routes' ) ); |
|
6 | } |
|
7 | ||
8 | public function register_routes() { |
|
9 | register_rest_route( 'wpcom/v2', '/hello', array( |
|
10 | array( |
|
11 | 'methods' => WP_REST_Server::READABLE, |
|
12 | 'callback' => array( $this, 'get_data' ), |
|
13 | ), |
|
14 | ) ); |
|
15 | } |
|
16 | ||
17 | public function get_data( $request ) { |
|
18 | return array( 'hello' => 'world' ); |
@@ 9-16 (lines=8) @@ | ||
6 | add_action( 'rest_api_init', array( $this, 'register_routes' ) ); |
|
7 | } |
|
8 | ||
9 | public function register_routes() { |
|
10 | register_rest_route( 'wpcom/v2', '/ping', array( |
|
11 | array( |
|
12 | 'methods' => WP_REST_Server::READABLE, |
|
13 | 'callback' => array( $this, 'get_data' ), |
|
14 | ), |
|
15 | ) ); |
|
16 | } |
|
17 | ||
18 | public function get_data( $request ) { |
|
19 | sleep(3); |