Add simple-status.php
This commit is contained in:
		
						commit
						eeb4f6156d
					
				| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
<?php
 | 
			
		||||
/*
 | 
			
		||||
Plugin Name: Simple Status
 | 
			
		||||
Description: Provides a custom endpoint for health checks.
 | 
			
		||||
Version: 1.0
 | 
			
		||||
Author: Colin
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
function simple_status_endpoint() {
 | 
			
		||||
    // Perform any necessary checks here
 | 
			
		||||
    $status = array('status' => 'ok');
 | 
			
		||||
    wp_send_json($status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Register the custom endpoint
 | 
			
		||||
add_action('rest_api_init', function () {
 | 
			
		||||
    register_rest_route('simple/v1', '/status', array(
 | 
			
		||||
        'methods' => 'GET',
 | 
			
		||||
        'callback' => 'simple_status_endpoint',
 | 
			
		||||
    ));
 | 
			
		||||
});
 | 
			
		||||
?>
 | 
			
		||||
		Loading…
	
		Reference in New Issue