WordPress REST API Plugin Development – Add Custom Endpoint

Add to your __construct function:

add_action( 'rest_api_init',[$this, 'register_routes'] );

And the rest api will take it from there. No need to process routes in your activation functions, and no need to flush the rules.

The $wp_rest_server is constructed after the plugins are loaded. Hence it is null when you instantiate your class in the plugin.